hi, I created a chart using highcharts in birt developer pro.
there is a script that computes the average and shows that avg as a line.
I would like that script to run when the user clicks on the chart, so I thought adding a simple event handler at the beginning of the script would do the trick. but so far i haven't gotten it to work.
here's the script (I commented out the bit at the beginning that doesn't work)
anyone know what I should do?
beforeDrawSeries: function(series, seriesOptions, tempChart, seriesIndex)
{
var totalValue = 0;
for ( var i = 0; i < series.data.length; i++ )
{
totalValue += series.data[i].y;
}
aveValue = totalValue / series.data.length;
for ( var j = 0; j < series.data.length; j++ )
{
if ( series.data[j].y <= aveValue )
{
continue;
}
}
},
afterRendering: function(myChart)
{
var chart=myChart.getCore();
var mySeries = chart.series[0];
mySeries.yAxis.addPlotLine({
color: 'orange',
width: 2,
value: aveValue,
id: 'averageValuePlotLine',
zIndex: 2
});
chart.addSeries({
name: 'Gemiddeld: ' + aveValue.toFixed(2),
color: 'orange',
marker: {
enabled: false
}
});
},