|
Something for the wishlist... |
Posted by Daniel on Sep-21-2010 21:27 |
|
Hi Peter,
As a very satisfied user of the this great product (what a great piece of engineering!) I tend to resort to chartdirectors for stuff that possibly are not within its reach.
I recently tried to produce a five-star-rating image (see sample of potential target) using the scatter point stuff (no axis of course...) that could produce numerical values (say 4.6 stars).... The list of symbols includes the requested start stuff, the coloring API is simple and brilliant, even for a dummmy like me.
I could output a few samples of ***** ratings at defined lengths (say 200x40 pixels). But sure, I was missing a few entries to get the thing properly delivered as it would certainly not scale properly. The API is a charting one. Not a generic graphic production tool.
Well may I say that I'd be glad to see the API enriched in this direction. Say the sparkline direction. Including star-ratings and others web-friendly and other gimmicks.
Chartdir library rocks. But the meter library it getting dated and painfully industrial. There is way to improve here. With relatively limited technical work IMHO.
Push on the great work!
|
Re: Something for the wishlist... |
Posted by Peter Kwan on Sep-22-2010 04:35 |
|
Hi Daniel,
Thanks for your valuable suggestions. We will consider them seriously.
I also think the meters and guages would need to be redesign to have a more modern look and feel.
For the five-star-rating image, I think you can do it as a scatter chart. Are you currently doing it this way?
We have been thinking about a "histogram" style of bar chart using arbitrary shapes, similar to the star-rating chart. I hope we can implement it in a future version of ChartDirector.
Regards
Peter Kwan |
Re: Something for the wishlist... |
Posted by Daniel on Sep-22-2010 15:20 |
|
"also think the meters and guages would need to be redesign to have a more modern look and feel."
Sure. My feeling is that the product could include some kind "small-items" production facility at a limited cost (development-wise). A bit like the meters but with more arbitrary objects as sources (the list of included shapes and associated graphical effects suits me fine).
"For the five-star-rating image, I think you can do it as a scatter chart. Are you currently doing it this way?"
Yes. A scatter chart can definitely produce them. But I only succeded to produce them at a defined size. Not fully dynamically. I can certainly resize the bitmap with gdiplus calls for example. But was unable to reduce them dynamically from within chartdirector.
Thanks again for the great work. |
Re: Something for the wishlist... |
Posted by Peter Kwan on Sep-22-2010 23:03 |
|
Hi Daniel,
To create a chart at a dynamic size, you may use a dynamic size instead of using a hard coded size. For example:
void drawChart(int width, int height)
{
XYChart *c = new XYChart(width, height);
c->setPlotArea(0, 0, width * 6 / 10, height - 1);
.....
}
Is the above what you need?
Regards
Peter Kwan |
Re: Something for the wishlist... |
Posted by Daniel on Sep-23-2010 22:56 |
|
Peter Kwan wrote:
Hi Daniel,
To create a chart at a dynamic size, you may use a dynamic size instead of using a hard coded size. For example:
void drawChart(int width, int height)
{
XYChart *c = new XYChart(width, height);
c->setPlotArea(0, 0, width * 6 / 10, height - 1);
.....
}
Is the above what you need?
Regards
Peter Kwan
That's exactly what I am doing. But I'm not able to reproduce the same content when the t(int width, int height) parameters are moving by a multiplication factor.
What works at factor 1 won't on other arbitrary value. The points are moving around their own way even when trying to lock the automatic scaling.
Well this library is a charting one. Not a generic drawing toolbox. But I'd like it to be able to generate those nifty small stuff that are now fashionable. Such as sparklines as documented by Tufte and other smart graphic helpers such as the one mentioned (build arbitrary images from numbers, such as a **** symbol driven by a numeric figures. Possibly not only integers!
I am plainly hinting at sideline functional additions to your wonderful product:)
Kind regards for your support:) |
Re: Something for the wishlist... |
Posted by Peter Kwan on Sep-24-2010 02:38 |
|
Hi Daniel,
I have just created a sample code to draw charts at arbitrary size. It seems to work normally. I have attached my test code, with 3 of the charts I drawn.
I suppose similar methods can be used to draw a "sparkline" (by changing the scatter layer with a line layer).
====================
#include "chartdir.h"
void makeChart(int width, int height, double value, const char *filename)
{
XYChart *c = new XYChart(width, height);
c->setPlotArea(-1, -1, width + 1, height + 1);
c->xAxis()->setLinearScale(-0.5, 4.5, Chart::NoValue);
c->yAxis()->setLinearScale(-0.5, 0.5, Chart::NoValue);
double data[] = { 0, 0, 0, 0, 0 };
c->addScatterLayer(DoubleArray(), DoubleArray(data, 5), "", Chart::StarShape(5), height - 2, c->xZoneColor(value - 0.5, 0x0000ff, Chart::Transparent), 0x000088);
c->makeChart(filename);
delete c;
}
int main(int argc, char *argv[])
{
makeChart(100, 20, 3.4, "chart1.png");
makeChart(250, 50, 3.4, "chart2.png");
makeChart(333, 333 / 5, 3.4, "chart3.png");
return 0;
}
=======================
If there is any issue in your code, is it possible to create a simple example (like the one I attached) that can illustrate the issue?
Regards
Peter Kwan
|
Re: Something for the wishlist... |
Posted by Daniel on Sep-24-2010 14:41 |
|
Peter Kwan wrote:
c->setPlotArea(-1, -1, width + 1, height + 1);
Hi Peter,
Solution found!
When looking at the code of my various tentative solutions, I found the same kind of code for the scaling. Not for the setplotarea cmd. As above and the -1 and +1 additions! Which, possibly, make sure that the scaling scheme does not get in the way:)
Kind regards
Daniel |
Re: Something for the wishlist... |
Posted by Jason on Oct-08-2010 23:40 |
|
This chart should be an example in the documentation. Nice job! |
Re: Something for the wishlist... |
Posted by Peter Kwan on Oct-09-2010 05:23 |
|
Hi Jason,
Thanks a lot for your valuable suggestion. I also think the chart is useful and looks OK, and can even be enhanced somewhat by gradient coloring. I have already added the sample code into our wish list to be consider for incorporation into a future version of ChartDirector.
Regards
Peter Kwan |
|