FusionCharts - Forum_16179.Dynamically changing palette colors
Created using FusionCharts Suite XT - www.fusioncharts.com
by Vishalika
HTML
<script src="http://static.fusioncharts.com/code/latest/fusioncharts.js"></script>
<script src="http://static.fusioncharts.com/code/latest/fusioncharts.charts.js"></script>
<script src="http://static.fusioncharts.com/code/latest/themes/fusioncharts.theme.fint.js"></script>
<div id="chart-container">FusionCharts will render here</div>
<div>
<input type="checkbox" id="changeColor" checked>Change palette colors</input>
</div>
JavaScript
FusionCharts.ready(function () {
var showPaletteCheckBox = document.getElementById('changeColor');
if (showPaletteCheckBox.addEventListener) {
showPaletteCheckBox.addEventListener("click", changeColor);
}
function changeColor(evt, obj) {
(showPaletteCheckBox.checked) ? revenueChart.setChartAttribute('palettecolors',"#000000,#111111"):
revenueChart.setChartAttribute('palettecolors', "#008ee4,#6baa01");
};
var revenueChart = new FusionCharts({
type: 'radar',
renderAt: 'chart-container',
width: '500',
height: '500',
dataFormat: 'json',
dataSource: {
"chart": {
"caption": "Comparison of Enterprise Level Antivirus Software",
"canvasborderalpha": "0",
"radarborderalpha": "50",
"radarborderthickness": "1",
"showlabels": "1",
"drawanchors": "0",
"ymaxvalue": "10",
"showlimits": "0","palettecolors":"#FF0000,#00FF00",
"bgcolor": "FFFFFF",
"legendborderalpha": "0",
"showborder": "0"
},
"categories": [
{
"category": [
{
"label": "Centralized Deployability"
},
{
"label": "Centralized Signature Updating"
},
{
"label": "Active Firewall"
},
{
"label": "Centralized Access & Firewall"
},
{
"label": "Centralized Network Health Monitoring"
},
{
"label": "Cost"
},
{
"label": "Technical Support"
}
]
}
],
"dataset": [
{
"seriesname": "Kaspersky",
"alpha": "40",
"data": [
{
...