ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Display of rect() decoration in viewport
Posted by David Wilson on Jul-30-2011 01:11
I have a special chart in which I must display bars (essentially rectangles) which rest on the marks of one axis (vertical axis, marks horizontal), but hide the marks on the other axis. The effect I am looking for is horizontal mark lines in front, bars behind those, vertical mark lines behind those.

I was getting good visual results using StepLineLayer to draw the bars, however, performance issues dictate I should use DrawArea::rect() to draw the bars. When I do this, the bars display behind both axis marks, which in my case doesn't look very good.

Is there a way to address this issue?

  Re: Display of rect() decoration in viewport
Posted by Peter Kwan on Jul-31-2011 03:01
Hi David,

By "axis marks", are you referring to the mark lines added using Axis.addMark? For these mark lines, by default, they are in front of all layers. You may use Mark.setDrawOnTop to configure it to be behind all layers (that is, on the plot area background like other grid lines). So you can add the bars using normal bar layers, add the horizontal marks normally, and add the vertical marks with setDrawOnTop(false) to make them stay behind the bars.

For the DrawArea.rect(), if you obtain the DrawArea using BaseChart.getDrawArea before "drawing" the chart (eg. makeChart), the rectangle will be draw on the chart background (as the chart is drawn after drawing the rectangle). If you obtain the DrawArea using makeChart3, the rectangle will be in front of the chart (as the chart is already drawn when you draw the rectangle). So the rectangle is either in front of all mark lines, or behind all mark lines. Therefore this method may not easily meet you needs. (You need to draw the mark lines using DrawArea as well to get the order you want.)

If you have already successfully draw the chart using StepLineLayer, you may consider to just use StepLineLayer. Unless you have over 10000 points, it is unlikely to cause any performance issues. (Since you can use DrawArea, I think you do not need image map support. If you are using image maps for tooltips or clickable hotspots, please use Layer.setHTMLImageMap to disable the image maps for the StepLineLayer.)

Hope this can help.

Regards
Peter Kwan