Hello,
I would like to implement a line chart which gives the user the opportunity to activate and to deactivate the crosshair with a drop-down menu. By default, the crosshair should not be visible.
The following code shows a sample script for the chart:
The crosshair remains invisible after calling displayCrosshair. The function only works properly if crosshair.visible has the value true:
How can I avoid this?
I would like to implement a line chart which gives the user the opportunity to activate and to deactivate the crosshair with a drop-down menu. By default, the crosshair should not be visible.
The following code shows a sample script for the chart:
<div id=
"chart"
></div>
<script type=
"text/javascript"
>
$(
"#chart"
).kendoChart({
categoryAxis: {
categories: [
"2012"
,
"2013"
,
"2014"
],
crosshair: {
color:
"green"
,
width: 2,
visible:
false
}
},
series: [{
type:
"line"
,
data: [1, 2, 3]
}]
});
function
displayCrosshair() {
var
chart = $(
"#chart"
).data(
'kendoChart'
);
chart.options.categoryAxis.crosshair.visible =
true
;
chart.refresh();
}
function
hideCrosshair() {
var
chart = $(
"#chart"
).data(
'kendoChart'
);
chart.options.categoryAxis.crosshair.visible =
false
;
chart.refresh();
}
</script>
The crosshair remains invisible after calling displayCrosshair. The function only works properly if crosshair.visible has the value true:
<script type=
"text/javascript"
>
$(
"#chart"
).kendoChart({
categoryAxis: {
categories: [
"2012"
,
"2013"
,
"2014"
],
crosshair: {
color:
"green"
,
width: 2,
visible:
true
}
},
series: [{
type:
"line"
,
data: [1, 2, 3]
}]
});
</script>
How can I avoid this?