Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

pie chart in javascript

// Using chartjs. 
// https://www.chartjs.org/docs/latest/charts/doughnut.html#pie
const data = {
  labels: [
    'Red',
    'Blue',
    'Yellow'
  ],
  datasets: [{
    label: 'My First Dataset',
    data: [300, 50, 100],
    backgroundColor: [
      'rgb(255, 99, 132)',
      'rgb(54, 162, 235)',
      'rgb(255, 205, 86)'
    ],
    hoverOffset: 4
  }]
};

const config = {
  type: 'pie',
  data: data,
};
Comment

javascript pie chart script

window.onload = function() {
 
var chart = new CanvasJS.Chart("chartContainer", {
	animationEnabled: true,
	title: {
		text: "Desktop Search Engine Market Share - 2016"
	},
	data: [{
		type: "pie",
		startAngle: 240,
		yValueFormatString: "##0.00"%"",
		indexLabel: "{label} {y}",
		dataPoints: [
			{y: 79.45, label: "Google"},
			{y: 7.31, label: "Bing"},
			{y: 7.06, label: "Baidu"},
			{y: 4.91, label: "Yahoo"},
			{y: 1.26, label: "Others"}
		]
	}]
});
chart.render();
 
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript sort multi-dimensional array by column 
Javascript :: javascript diffence between a++ and ++a 
Javascript :: appendchild element once if element present in js 
Javascript :: cogo toast react 
Javascript :: how to combine two regular expressions in javascript 
Javascript :: ajax error slider revolution 
Javascript :: material ui navbar 
Javascript :: nestjs framwork 
Javascript :: usestate previous state 
Javascript :: sum is not working in js 
Javascript :: react call bind apply 
Javascript :: Multiple line string in JS 
Javascript :: Array iteration in ES6 
Javascript :: vscode read environment variables 
Javascript :: use effect hook 
Javascript :: chrome storage local update 
Javascript :: changing map style react-leaflet 
Javascript :: sorting an array based on certain element 
Javascript :: array.length in mongoose query 
Javascript :: delete request reaxt 
Javascript :: Selectores de jQuery CSS básicos 
Javascript :: javascript parseInt() method 
Javascript :: puppeteer set up code 
Javascript :: how to fetch data from another website in javascript 
Javascript :: decode jwt token nodejs 
Javascript :: run the for loop in the html elements and show the limited elements in javascript 
Javascript :: add marker on map geocoder result mapbox 
Javascript :: npm node size 
Javascript :: array validation in jquery 
Javascript :: cypress set date to specific date 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =