Reputation: 13
I have a chart with a single series as well as a StripLines for the average
Chart with single series and StripLines
[1]: https://i.sstatic.net/RRXsA.png
as you can see the values above the Stripline are green and below are red this is done with the following expression under series properties and marker color:
=iif(Sum(Fields!Session_Time_Used.Value)/SUM(Fields!Available_Time.Value)<0.68,"Red","Green")
what I would like is for <0.68 to be a the same value of the StripLine which is calculated with this expression:
=Sum(Fields!Session_Time_Used.Value)/SUM(Fields!Available_Time.Value)
Upvotes: 0
Views: 146
Reputation: 5222
If I understand you correctly, you can make your chart simpler using negativeColor and threshold parameters: http://api.highcharts.com/highcharts#plotOptions.scatter.threshold http://api.highcharts.com/highcharts#plotOptions.scatter.negativeColor
You can calculate your mean value on your load callback function. Then you can add your plotLine and change threshold to mean value:
function(chart) {
var sum = 0,
ind = 0,
mean;
Highcharts.each(chart.series[0].data, function(p, i) {
sum += p.y;
ind++;
});
mean = sum / ind;
chart.yAxis[0].addPlotLine({
value: mean,
color: 'green',
width: 2
});
chart.series[0].update({
threshold: mean
});
}
Here you can see an example how it can work: http://jsfiddle.net/kmn0fo2e/2/
Kind regards.
Upvotes: 1