|
Wish List Item |
Posted by Snow on Jun-13-2011 22:23 |
|
Hello,
First, I would like to say that your product is awesome. Great job! So far, I have been able to do everything I have needed, with only 1 exception. And that is the ability to use patterns for bar charts, such as cross-hatching, etc. Or the ability to use an image as a fill pattern for the bar. There are probably ways to manually draw this on the chart, but an easy way to assign a fill to a dataset or to 1 specific bar (so as to draw attention, or remove attention) from that 1 data point.
Anyway, great job, I look forward to your new releases.
Peter
|
Re: Wish List Item |
Posted by Peter Kwan on Jun-14-2011 01:03 |
|
Hi Snow,
You can use any pattern to fill a bar. The pattern can be loaded from an image file, or you can provide an array of colors (an array of integers) that represents the colors of a N x M bitmap.
First, you may use either BaseChart.patternColor or BaseChart.patternColor2 to define the pattern. The above methods will return an integer. You can use the integer as the bar color. The bar will then be filled by the pattern color.
To fill a dataset, please set the bar color of that dataset to your pattern color.
To fill a specific bar, there are two methods:
(a) You may use addBarLayer3. This allows you to specify a different color for each bar. So you can specify all bars are of the same color, except one of them which is your pattern color.
(b) You may add another bar layer with just one bar (with all the other positions set to NoValue), and put that layer on top of your real bar layer. You can then set the color of that one bar to your pattern color.
Hope this can help.
Regards
Peter Kwan |
Re: Wish List Item |
Posted by Snow on Jun-14-2011 01:48 |
|
Thank you for the information Peter. Once again, great work!
Peter |
Re: Wish List Item |
Posted by James Moberg on Jun-14-2011 08:21 |
|
I like the idea of using a fill effect or hatch pattern. You make a nice reference to the technique here:
http://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&pattern=patternColor2&thread=1207519331
Do you have access to a recommended library of arrays with patterns or tranparent GIF/PNG files? (I don't want to reinvent the wheel and become a graphic designer to incorporate fill patterns on a chart.)
I've searched online extensively and haven't been able to find anything. I did find a combined graphic with a bunch of pattern styles and names, but nothing in separate files.
Are you able to include more base patterns (images or arrays) with the base samples or link to them online?
Thanks.
|
Re: Wish List Item |
Posted by Peter Kwan on Jun-15-2011 01:23 |
|
Hi James,
Thanks for a lot for your valuable suggestion. We will consider this in a future version of ChartDirector.
I think in additional to the bitmap pattern, we also need an API to allow modifying the pattern. For example, we may need to allow changing the foreground and background colors of the pattern, as it is likely the application may want the pattern to be in a specific color. That's why we may need to modify ChartDirector to support this as well.
Regards
Peter Kwan |
Re: Wish List Item |
Posted by James Moberg on Jun-15-2011 02:41 |
|
In the meantime, do you have any existing samples of array patterns or chart-friendly background images? The sample files don't contain any array samples and there's only the single "snowflake" image.
I'm working on a project where I need to allow both color and fill patterns to be selectable options for a chart (industry requirement).
Here's a site with lots tileable patterns, but they are all pre-colored (not selectable color):
http://www.k10k.net/pixelpatterns/
This stripe generator is cool, but there are only 8 styles of stripes (not enough fills):
http://www.stripegenerator.com/ |
Re: Wish List Item |
Posted by Peter Kwan on Jun-16-2011 01:48 |
|
Hi James,
We do not really have a long list of samples of array patterns. A few ChartDirector sample code does have patterns (like the "Symbol Line Chart" sample code and the "Pattern Area Chart" sample code.
If the list of patterns you listed in your previous message is acceptable to you, you may try to create the array of colors yourself. First, for each pattern, find a unit "tile" for the pattern. Then copy the pixels (which is either black or white in those patterns) in the unit "tile" to an array.
When you actually want to use the patterns in the chart, change the black pixels and white pixels to whatever colors you want to use.
For some pattens, the unit tile is trivial. For example, for the horizontal pattern (Horizontal, LightHorizontal, NarrowHorizontal), the patterns are:
Horizontal {1, 0, 0, 0, 0, 0, 0, 0}
LightHorizontal {1, 0, 0, 0}
NarrowHorizontal {1, 0}
The 1 and 0 above are arbitrarily numbers. It is expected your code will change them into the colors chosen by your user when you actually use the patterns.
The same pattern above can also be used for vertical strips (just declared the bitmap to be 8 x 1 instead of 1 x 8).
For a diagonal pattern, the it is like:
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
Hope this can help.
Regards
Peter Kwan |
|