Highcharts.js : Adding Color Axis to charts that not support it
Highcharts JS is a JavaScript charting library based on SVG and VML rendering. Official website : www.highcharts.com
In this post, we will extend this library to add a Color Axis to charts that not support it.
- What is Color Axis :
A Color Axis is represented by a gradient inside the legend on the chart and indicate colored values on the chart.
You can find a demonstration here : http://www.highcharts.com/demo/treemap-coloraxis
Color Axis is supported by heat map chart, and we will use heat map properties to add Color Axis to other charts.
- Dependencies :
highcharts.js
heatmap.js
jquery
- Extending Pie chart :
To add a Color Axis to a Pie chart we will :
Extend Pie Series and override these properties : optionalAxis, colorKey, translateColors, type, axisTypes.
Wrap the axis prototype render function to not render axis on Pie char.
Wrap the Pie Series translate function to call heat map translateColor function.