Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

chart js stacked bar group

new Chart(document.getElementById("MyChart"), {
  type: 'bar',
  data: {
    labels: [2017, 2018, 2019, 2020, 2021, 2022, 2023],
    datasets: [{
      label: "Income - Base",
      type: "bar",
      stack: "Base",
      backgroundColor: "#eece01",
      data: [30, 31, 32, 33, 34, 35, 36],
    }, {
      label: "Tax - Base",
      type: "bar",
      stack: "Base",
      backgroundColor: "#87d84d",
      data: [-15, -16, -17, -18, -19, -20, -21],
    }, {
      label: "Income - Sensitivity",
      type: "bar",
      stack: "Sensitivity",
      backgroundColor: "#f8981f",      
      data: [20, 21, 22, 23, 24, 25, 26],
    }, {
      label: "Tax - Sensitivity",
      type: "bar",
      stack: "Sensitivity",
      backgroundColor: "#00b300",
      backgroundColorHover: "#3e95cd",
      data: [-10, -11, -12, -13, -14, -15, -16]
    }]
  },
  options: {
    scales: {
      xAxes: [{
        //stacked: true,
        stacked: true,
        ticks: {
          beginAtZero: true,
          maxRotation: 0,
          minRotation: 0
        }
      }],
      yAxes: [{
        stacked: true,
      }]
    },
  }
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: capitalize the string 
Javascript :: download canvas js 
Javascript :: css div at bottom of div 
Javascript :: push notification javascript 
Javascript :: fibonacci javascript 
Javascript :: jquery select div in div 
Javascript :: ReferenceError: Buffer is not defined 
Javascript :: javascript json decode 
Javascript :: reverse a date in javascript 
Javascript :: js generate random number 
Javascript :: what is data node in big data 
Javascript :: regex for company name 
Javascript :: check if message mentions users discord js 
Javascript :: drop down listing in angular form 
Javascript :: startswith 
Javascript :: run build version react 
Javascript :: tofixed currency in js 
Javascript :: JAVASCRIPT KEYDOWN AROW 
Javascript :: merge array no duiplicates js 
Javascript :: how to sort array by dates 
Javascript :: get an html img tag from a string 
Javascript :: contenteditable javascript 
Javascript :: vue watch object member 
Javascript :: uuid timestamp in javascript 
Javascript :: jquey body onload 
Javascript :: how to get datetime javascript now 
Javascript :: how to code localstorages in html 
Javascript :: angular production vs development mode 
Javascript :: react save to local storage 
Javascript :: cryptojs decrypt 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =