|
Mixing line styles |
Posted by Chris Witt on Dec-21-2010 06:07 |
|
Is it possible to mix line styles being used in a chart?
For example, let's say I have a 5x5 grid. I want a dashed line styles for the most part. However, I want the middle 3x3 grid outlined using solid lines instead.
See attached image for reference.
|
Re: Mixing line styles |
Posted by Peter Kwan on Dec-21-2010 17:10 |
|
Hi Chris,
Yes. You can use xZoneColor and yZoneColor to achieve what you want.
For example, suppose your axis scale is from 0 - 5, and you want the middle section 1 - 4 to be in solid color, while the rest in dotted style. The code is like (in VB/VBScript):
leftThreshold = 1
rightThreshold = 4
bottomThreshold = 1
topThreshold = 4
mySolidColor = &H80000000
myDashColor = c.dashLineColor(mySolidColor, cd.DotLine)
myXColor = c.xZoneColor(leftThreshold, myDashColor, c.xZoneColor(rightThreshold, mySolidColor, myDashColor))
myYColor = c.yZoneColor(bottomThreshold, myDashColor, c.yZoneColor(topThreshold , mySolidColor, myDashColor))
Call c.getPlotArea().setGridColor(myXColor, myYColor)
If you do not know what are the axis scales, you may call XYChart.layoutAxes to ask ChartDirector to auto-scale the axes, then use Axis.getMinValue and Axis.getMaxValue to find out the range of the axes.
Hope this can help.
Regards
Peter Kwan |
Re: Mixing line styles |
Posted by Chris on Dec-23-2010 04:22 |
|
Hmmm... that does help somewhat. But I guess what I'm looking for more is to just have that inner 3x3 grid solid. The code you suggested is making *each* box inside of there completely solid.
In other words, for example, the center square should not have any solid lines. The only solid lines should be just one square around the inner-most 3x3 squares.
Thanks again, Peter! |
Re: Mixing line styles |
Posted by Chris on Dec-23-2010 04:24 |
|
Just for an example, here's the image now...
|
Re: Mixing line styles |
Posted by Peter Kwan on Dec-23-2010 13:03 |
|
Hi Chris,
For your case, I think you just need to add a rectangle in the place you want. You may add a rectangle by adding an empty text box. May be you can try:
leftSide = CInt(c.getPlotArea().getLeftX() + c.getPlotArea().getWidth() * 0.2)
rightSide = CInt(c.getPlotArea().getLeftX() + c.getPlotArea().getWidth() * 0.8)
topSide = CInt(c.getPlotArea().getTopX() + c.getPlotArea().getHeight() * 0.2)
bottomSide = CInt(c.getPlotArea().getTopX() + c.getPlotArea().getHeight() * 0.8)
Set t = c.addText(leftSide, topSide, "")
Call t.setSize(rightSide - leftSide + 1, bottomSide - topSide + 1)
Call t.setBackground(cd.Transparent, &H000000)
Hope this can help.
Regards
Peter Kwan |
Re: Mixing line styles |
Posted by Chris on Dec-24-2010 04:34 |
|
Oh heck ya! That does the trick! Thanks again, guru Peter! |
|