|
Crosshatch fill color |
Posted by David Hope on Aug-09-2016 04:18 |
|
Is there anyway to generate a cross hatch pattern for a fill color? I'd like to overlay part of my graph with the cross hatch pattern to indicate that the data in that portion of the graph is questionable.
I can draw the polygon and using the .dashLine color, I can create vertical stripes, but is there anyway to do cross hatch or diagonal stripes?
Thanks,
David |
Re: Crosshatch fill color |
Posted by Peter Kwan on Aug-09-2016 16:18 |
|
Hi David,
Yes, you can use a "pattern color" as the fill color. The "pattern color" can be created with BaseChart.patternColor or BaseChart.patternColor2. Basically, your code provides an image file or just an array of pixels to the above methods, and it will return an integer representing the pattern color. You can use this integer just like a regular color.
For the "Pattern Area Chart" sample code provides an example of using pattern colors.
http://www.advsofteng.com/doc/cdnet.htm#patternarea.htm
You can see in the above example, the title bar is filled with "horizontal stripes", created using a pattern with 2 pixels. The area fill color is using a pattern loaded from an image file.
For a diagonal stripes, you can try to use 16 pixels (or 9 pixels or 25 pixels) arranged in a square (4 x 4 for 16 pixels), and the diagonal pixels. The exact pixels depend on the direction of the diagonal, how dense the stripes are, the line width of the strips, the colors of the stripes and the "blank" region, etc..
Hope this can help.
Regards
Peter Kwan |
Re: Crosshatch fill color |
Posted by David Hope on Aug-09-2016 21:17 |
|
thanks, that is exactly what I needed. I ended up going with a 9x9 pattern just to make my cross-hatching clear.
David |
|