PDA

View Full Version : Char -> Line Series marker colour being ignored



BrommyCanary
14 Jun 2013, 1:53 AM
Hi,

I'm using the Line Series on a Chart to display some very simple data and I'd like to change the markers for the data points to a different colour depending on their value (low values appear red, high values appear green). The chart is reloaded when the user selects a value in a grid. I've got some code that will change the colour of the marker for a brief moment (before the animation begins) but it very quickly is returned to the theme colour.

My series config code is below (in the example I'm just trying to set each marker to purple). As I said, you briefly see the crosses on the graph change, but once animation is complete they return to the blue as define by the theme of the chart.



series: [
{
type: 'line',
highlight: {
size: 7,
radius: 7
},
smooth: true,
fill: false,
axis: 'left',
xField: 'date',
yField: 'mins_on_charge',
title: ['Mins on Charge'],
markerConfig: {
type: 'cross',
size: 4,
radius: 4,
'stroke-width': 0
},
renderer: function(sprite, record, attr, index, store) {
//draw diffrent color

sprite.setAttributes({fill: '#ff1493'}, true);
return attr;
}
}
]


Any help is greatly appreciated!

Chris.

slemmon
16 Jun 2013, 10:49 PM
There's not a renderer method to hook the markers into so you can edit their attributes based on the data point / record. The markerConfig is applied to each of the markers globally.

BrommyCanary
16 Jun 2013, 10:58 PM
Thanks for the reply.

Is there any way of achieving what I'm after then? That is, to have the points on the graph that represent that values indicated by a different colour, depending on the value?


Chris.

slemmon
17 Jun 2013, 12:29 PM
Not without doing an override / extension of the series.

anton.dimitrov
12 Sep 2014, 8:22 AM
@slemmon

Can you suggest where to start with the override, because after spending several days in looking for the proper overwrite the chart still returns the initial color.
I hooked up a 'render' listener on the marker sprite but still no result.

10x