Javascript examples for highcharts:Chart Color
spider web chart with various background color
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript"> $(function () {/*from w ww. jav a 2s . c o m*/ var chart = new Highcharts.Chart({ chart: { renderTo: 'container', polar: true, type: 'line' }, title: { text: 'Budget vs spending', x: -80 }, pane: { size: '80%' }, xAxis: { categories: ['Sales', 'Marketing', 'Development', 'Customer Support', 'Information Technology', 'Administration'], tickmarkPlacement: 'on', lineWidth: 0 }, yAxis: { gridLineInterpolation: 'polygon', lineWidth: 0, min: 0 }, tooltip: { shared: true, pointFormat: '<span style="color:{series.color}">{series.name}: <b>${point.y:,.0f}</b><br/>' }, legend: { align: 'right', verticalAlign: 'top', y: 70, layout: 'vertical' }, series: [{ name: 'Allocated Budget', data: [43000, 19000, 60000, 35000, 17000, 10000], pointPlacement: 'on' }, { name: 'Actual Spending', data: [50000, 39000, 42000, 31000, 26000, 14000], pointPlacement: 'on' }] }); var colors = [ "pink", "yellow", "blue", "red", "green", "cyan", "teal", "indigo" ]; var parts = 6; for(var i = 0; i < parts; i++) { centerX = chart.plotLeft + chart.yAxis[0].center[0]; centerY = chart.plotTop + chart.yAxis[0].center[1]; axisLength = chart.yAxis[0].height; angleOffset = -Math.PI/2; angleSegment = Math.PI/(parts/2); firstPointX = centerX + (axisLength * Math.cos(angleOffset + (angleSegment * i))); firstPointY = centerY + (axisLength * Math.sin(angleOffset + (angleSegment * i))); secondPointX = centerX + (axisLength * Math.cos(angleOffset + (angleSegment * (i+1)))); secondPointY = centerY + (axisLength * Math.sin(angleOffset + (angleSegment * (i+1)))); chart.renderer.path([ 'M', centerX, centerY, 'L', firstPointX, firstPointY, 'L', secondPointX, secondPointY, 'Z' ]).attr({ fill: colors[i % colors.length], 'stroke-width': 1, 'opacity': 1 }).add(); } }); </script> </head> <body> <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/highcharts-more.js"></script> <script src="https://code.highcharts.com/modules/exporting.js"></script> <div id="container" style="width: 500px; height: 400px;"></div> </body> </html>