Hi,
I'm facing a rather nasty problem here with the ChartView.
I want to draw 4 zones on the chart which show the user if a signal is off, kind of like quality zones. See attached image for an example.
The first zone is running from +infinity on Y-axis to a given Y-value, the second zone starts from this Y-value down to another Y-value.
Then there is a "normal" zone, which doesn't need to be drawn and then starting from a third Y-value down to a fourth Y-value is the third zone. Finally the fourth zone starts from the fourth Y-value up unto -infinity on Y-axis.
You'll get something like this:
-------------------------------------------------- + INFINITY
ZONE 1
-------------------------------------------------- Y-value 1
ZONE 2
-------------------------------------------------- Y-value 2
NORMAL ZONE
-------------------------------------------------- Y-value 3
ZONE 3
-------------------------------------------------- Y-value 4
ZONE 4
-------------------------------------------------- - INFINITY
I tried using the area series and this works, but it's not really nice. I need to draw the series on top off each other and the normal zone needs to be drawn too, but then in white. Doing so doesn't make the rulers show. Making the normal zone more transparent, is just awful!
So I placed a Canvas on top of the ChartView and wanted to render rectangles over the ChartView. I finally came up with a transformation algorithm since there is no method on the ChartView to convert a data-point to a pixel coordinate. Right now I'm at the point that I have this working, but... now I need to correct for the zooming & scrolling too.
This feels so wrong and hope someone can shed a light on this problem and guide me towards another path?
Bottom line, am I missing something or is my method with the Canvas the only way?
Kind regards,
Dwight
I'm facing a rather nasty problem here with the ChartView.
I want to draw 4 zones on the chart which show the user if a signal is off, kind of like quality zones. See attached image for an example.
The first zone is running from +infinity on Y-axis to a given Y-value, the second zone starts from this Y-value down to another Y-value.
Then there is a "normal" zone, which doesn't need to be drawn and then starting from a third Y-value down to a fourth Y-value is the third zone. Finally the fourth zone starts from the fourth Y-value up unto -infinity on Y-axis.
You'll get something like this:
-------------------------------------------------- + INFINITY
ZONE 1
-------------------------------------------------- Y-value 1
ZONE 2
-------------------------------------------------- Y-value 2
NORMAL ZONE
-------------------------------------------------- Y-value 3
ZONE 3
-------------------------------------------------- Y-value 4
ZONE 4
-------------------------------------------------- - INFINITY
I tried using the area series and this works, but it's not really nice. I need to draw the series on top off each other and the normal zone needs to be drawn too, but then in white. Doing so doesn't make the rulers show. Making the normal zone more transparent, is just awful!
So I placed a Canvas on top of the ChartView and wanted to render rectangles over the ChartView. I finally came up with a transformation algorithm since there is no method on the ChartView to convert a data-point to a pixel coordinate. Right now I'm at the point that I have this working, but... now I need to correct for the zooming & scrolling too.
This feels so wrong and hope someone can shed a light on this problem and guide me towards another path?
Bottom line, am I missing something or is my method with the Canvas the only way?
Kind regards,
Dwight