|
addInterLineLayer for Polar charts |
Posted by Steve Valliere on Jul-21-2011 02:44 |
|
I'm working on something to simulate a circular chart recorder. A full 360 degree cycle will represent a week, so the program will be collecting many intermediate measurements (of temperature, in this case) before it actually adds a new value to the chart. The customer would like to see a colored band representing the full temp range with a line for the current temp each time something is plotted.
I've got everything done except that I cannot figure out how to create a colored band for the temp range. I have lines for the min, max and current values, but it seems that addInterLineLayer is not supported for polar charts.
It seems like an obvious feature for closed loop charts, though mine is open loop. However, even for open loop, just connecting the beginnings and ends of the two lines would make a nice closed area to fill. In my case, the two lines can NEVER CROSS, though they may TOUCH (if min/max/current are all the same) but others might have more complex lines, I suppose.
Is there any chance that this might be added to a future version of ChartDirector?
In the meantime, I'm going to try to simulate it using area layers. I'll need to make a colored area for the MAX line, and a transparent layer for the MIN, in the hope of resetting the fill color to the default background (which I have filled with alternating colors for each major time unit on the chart). If that doesn't work, I suppose I could change to a solid background and fill the MIN area with that to make it look like only the area between min/max is colored. The thing is, the documentation seems to imply that area layers need to be closed loop, so I may be in for interesting times. Ah the fun of experimentally determining how library functions work. Sigh. Smile. |
Re: addInterLineLayer for Polar charts |
Posted by Peter Kwan on Jul-21-2011 19:13 |
|
Hi Steve,
The method to use the transparent layer for MIN will not work. It is because fill something with the transparent color is equivalent to not filling anything at all. So the MIN will not have any effect at all.
Full the MIN with the same color as the background will probably work, but it restricts your background color to be an "independent color" (that the filling color is defined independent of the object being filled - such as solid colors, gradients or wallpaper patterns).
For the polar area layer, it does assume a closed loop, because to define an area, a closed loop is always needed. For an open line, we need to determine how to handle the two loose ends to form a loop. The default is just to join the two end points, and this is the closed loop. For your case, you may want to join the end points to the origin (0, 0) instead. To do this, just insert an additional point (0, 0) to your data series.
Hope this can help.
Regards
Peter Kwan |
Re: addInterLineLayer for Polar charts |
Posted by Steve Valliere on Jul-21-2011 20:10 |
|
Peter Kwan wrote:
For the polar area layer, it does assume a closed loop, because to define an area, a closed loop is always needed. For an open line, we need to determine how to handle the two loose ends to form a loop. The default is just to join the two end points, and this is the closed loop. For your case, you may want to join the end points to the origin (0, 0) instead. To do this, just insert an additional point (0, 0) to your data series.
Thanks for the quick and helpful reply!
I discovered that setting the inner area to transparent didn't work. I didn't think it would, but since it COULD, I gave it a shot. <smile>
I did think of adding an extra point of (0,0) to the data set (actually, I used (360,0), but it ended up the same) and that ALMOST works. Except for the extra line segment stabbing into the heart of the chart. However, as I write this I realize that I didn't think to put Chart::NoValue as the final entry in the data set for the LINE, which will probably make it look just like I want.
Still, being able to use addInterLineLayer between two polar tracks would be clearer and, as I said before, just connecting the beginnings and endings or the lines would solve the open loop issue for most uses. Any chance that might make it into a future version?
|
Re: addInterLineLayer for Polar charts |
Posted by Steve Valliere on Jul-21-2011 21:17 |
|
Got it working as I'd hoped. Thanks again for the help!
Still hope that addInterLineLayer gets added for polar charts, though -- it would be MUCH more straightforward than the work-around I've got going.
|
Re: addInterLineLayer for Polar charts |
Posted by Peter Kwan on Jul-22-2011 01:05 |
|
Hi Steve,
Yes. The addInterLineLayer should be useful. We will consider that in a future version of ChartDirector.
Actually, we have thought of the addInterLineLayer for the polar chart in the past, but had not implemented it. There are a few issues we still need to think carefully for the general case. The two lines may not start or end at the same angle; they may not have the same number of points and their points may not align at the same angle; there may be gaps (NoValue) in one or both the lines, etc.. (The algorithm we currently used for the XY Chart case cannot be extended to the polar chart case, so we need to write a new algorithm.)
Regards
Peter Kwan |
|