cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Chart Question

Former Member
0 Kudos

Hi,

If I have a custom chart where Pen 1 is Bar and Pen 2 is a Line , is it possible to change the Pen 1 color based on , lets say if the value is greater or less that Pen 2 value?

After some research I think this is not do-able with the iChart , do let me know if somebody thinks otherwise.

Also does someone have any alternative solution?

Thanks

Udayan

Accepted Solutions (1)

Accepted Solutions (1)

jcgood25
Active Contributor
0 Kudos

I'm trying to interpret what you are after, but Chart coloring is Pen based (12.1 introduces some color contexting options for the chart), so you will need 3 pens if you want to have the 'target' line and the bar colors changing depending upon whether they are above or below the line.

If you construct your dataset with the current line data, and then instead of only one column for the bar make it two. For Bar1 make your pen color the 'less than line color' and Bar2 make your pen color the 'greater than line color'. In the data values for Bar1 and Bar2 just return null in the place where you want the pen to be missing.

Sample Dataset Look

Line Bar1 Bar2

50 null 75

50 34 null

50 null 65

50 40 null

If Bar1 is Green (below the line threshold) and Bar2 is Red (above the threshold) the opposite bar will not be rendered because of the null state. Bar1 and Bar2 = Bar (they will naturally become stacked in Custom mode).

Regards,

Jeremy

Former Member
0 Kudos

Thanks Jeremy.

Your interpretation is right on.

This is the exact approach how I went about doing things.

But I chose "Bar" instead of "Stacked Bar" in Data Series Details tab of the Display Template (How foolish of me!) and the chart was behaving like a "Group Bar" chart rather than a "Stacked" one and that ways even though I was getting the desired output but I was loosing a lot of screen real estate because of the "Group" nature of the chart.

Thanks a lot once again.

Regards

Udayan

Answers (0)