Rank: Advanced Member
Groups: Administrators, DataVizJavaScript, jQueryChart, jQueryDV, MvcChart, Registered Joined: 1/3/2011(UTC) Posts: 483
Thanks: 0 times Was thanked: 87 time(s) in 87 post(s)
|
Hi, Unfortunately, currently plot bands don't have "visible" option, but you can try using the following code: Code: <script lang="javascript" type="text/javascript"> $(document).ready(function () {
var chartOptions = { title: { text: 'Plot Bands' }, animation: { duration: 1 }, axes: [ { location: 'left', type: 'linear', majorGridLines: { strokeDashArray: [1, 3] }, plotBands: [ { fillStyle: '#fcb441', from: 40, to: 60, zIndex: 0, // Posible values - 0, 1, 2 title: 'Good' }, { fillStyle: '#e0400a', from: 60, to: 70, zIndex: 0, // Posible values - 0, 1, 2 title: 'Very Good' } ] } ], series: [ { type: 'column', data: [['A', 45], ['B', 35], ['C', 68], ['D', 50], ['E', 5], ['F', 44]] } ] };
$('#jqChart').jqChart(chartOptions);
$('input[type=checkbox]').change(function () { var checked = this.checked; var value = this.id;
var plotBands = [];
if ($("#Checkbox1").prop('checked')) { plotBands.push({ fillStyle: '#fcb441', from: 40, to: 60, zIndex: 0, // Posible values - 0, 1, 2 title: 'Good' }); };
if ($("#Checkbox2").prop('checked')) { plotBands.push({ fillStyle: '#e0400a', from: 60, to: 70, zIndex: 0, // Posible values - 0, 1, 2 title: 'Very Good' }); };
chartOptions.axes[0].plotBands = plotBands;
$('#jqChart').jqChart(chartOptions);
}); }); </script>
</head> <body> <div> <div id="jqChart" style="width: 500px; height: 300px;"> </div> </div> <input id="Checkbox1" value="1" type="checkbox" checked="checked" /> Display "Good" <br /> <input id="Checkbox2" value="2" type="checkbox" checked="checked" /> Display "Very Good" </body> Best Regards, Dragan Matek jqChart Inc.
|