Sparkline chart dynamic min,max glyph color

I am trying to bind High Marker Color in a sparkline chart bound to tag history set to display 1 day of data to corresponding colors on a moving analog indicator using such expression:

if(({ZoneReadings.AHU 0 Zone Data.0C Sparkline Chart.chartMax} > {ZoneReadings.AHU 0 Zone Data.0C Moving Analog Indicator.hihiAlarm})||({ZoneReadings.AHU 0 Zone Data.0C Sparkline Chart.chartMax} < {ZoneReadings.AHU 0 Zone Data.0C Moving Analog Indicator.loloAlarm}),color(226,32,40),
	if({ZoneReadings.AHU 0 Zone Data.0C Sparkline Chart.chartMax} > {ZoneReadings.AHU 0 Zone Data.0C Moving Analog Indicator.hiAlarm}, color(236,134,41),
		if({ZoneReadings.AHU 0 Zone Data.0C Sparkline Chart.chartMax} > {ZoneReadings.AHU 0 Zone Data.0C Moving Analog Indicator.desiredHi},color(245,225,27),color(147,194,228))
	)
)

It works fine for the most part and produces the following

The problem I’m encountering (circled) is that apparently “Sparkline Chart.chartMax” property includes the entire history of a tag, not just 1 day. Even though, only one day is shown. I debugged it using console and database queries. It creates a discrepancy in color. Is it a bug or what am I doing wrong?

Can you show the query that’s generating the data? The sparkline can’t be showing history outside your query range unless you’re leaking it in somehow.

Standard Tag History with the following settings is supposedly driving it:

The thing is that it’s NOT showing it, but the “ChartMax” function does include data outside of a Tag History settings.

That all looks OK at first glance.
Going back to your original post, I can’t see what the problem is. The blue triangle in the white oval seems to be on the maximum point of the displayed sparkline. What makes you think it’s from outside the selected date range?

The problem is that it’s the wrong color. Both triangles supposed to be red since min & max are below the “loloAlarm” value. The triangle is supposed to be blue only in the “desired” range indicated by the pale blue area there.
I’ve manually output “chartMax” value to the console and it’s indeed in the desired range, but that value was/is 3 days old. As you can see by the sparkline nothig was even close to desired range, unlike the sparkline just above it where max does fall in the desired range.

Not sure if that’s what was throwing it off. The “Retain Rows” checkbox was set to ‘true’ and that, I think, kept all of the tag history data beyond the current data range.

1 Like