[rrd-developers] Pie charts?
Alex van den Bogaerdt
alex at ergens.op.het.net
Sun Jun 22 21:52:34 CEST 2008
On Sun, Jun 22, 2008 at 06:10:56PM +0200, Florian Forster wrote:
> Hi Ruslan,
>
> On Sun, Jun 22, 2008 at 05:39:26PM +0200, Ruslan Valiyev wrote:
> > Does RRDTOOL support graphing pie charts?
>
> no, as far as I know it doesn't. There has been a (short) discussion in
> May 2007[0] and it's on the feature list for version 1.4[1], but I guess
> nobody started on that yet.
Actually I have. Unfortunately I had to postpone development for an as of
yet undetermined period. At a time rrdtool had some beta code in it which
did work. This code can still be found in v1.2 (perhaps in 1.3 as well?)
but is currently made inactive.
Who knows, it may still work.
grep -i pie ~/svn/rrdtool-1.2/src/*graph*[ch]
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:pie_part(image_desc_t *im, gfx_color_t color,
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: double PieCenterX, double PieCenterY, double Radius,
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: PieCenterX+sin(startangle)*Radius,
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: PieCenterY-cos(startangle)*Radius,
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: PieCenterX,
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: PieCenterY,
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: PieCenterX+sin(endangle)*Radius,
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: PieCenterY-cos(endangle)*Radius,
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: PieCenterX+sin(angle)*Radius,
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: PieCenterY-cos(angle)*Radius );
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:, int piechart
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: ** |a| a| | pie |
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: Xpie =0, Ypie =0,
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: if (piechart) {
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: im->piesize=im->xsize<im->ysize?im->xsize:im->ysize;
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: Xpie=im->piesize;
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: Ypie=im->piesize;
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: pie chart area. */
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: im->ximg += Xpie;
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: if (Xpie) im->ximg += Xspacing;
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: /* reserve space for main and/or pie */
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: if (im->yimg < Ypie) im->yimg = Ypie;
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: /* reposition Pie */
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: /* The pie is placed in the upper right hand corner,
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: im->pie_x = im->ximg - Xspacing - Xpie/2;
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: im->pie_y = im->yorigin-Ymain+Ypie/2;
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: im->pie_x = im->ximg/2;
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: im->pie_y = im->yorigin-Ypie/2;
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: int piechart = 0;
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: double PieStart=0.0;
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: /* check if we need to draw a piechart */
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: piechart=1;
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:&&(piechart==0)
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: /* If there's only the pie chart to draw, signal this */
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: if (i==0) piechart=2;
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:,piechart
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: if (piechart != 2) {
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: if (piechart) {
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: pie_part(im,im->graph_col[GRC_CANVAS],im->pie_x,im->pie_y,im->piesize*0.5,0,2*M_PI);
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: pie_part(im,im->gdes[i].col,
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: im->pie_x,im->pie_y,im->piesize*0.4,
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: M_PI*2.0*PieStart/100.0,
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: M_PI*2.0*(PieStart+im->gdes[i].yrule)/100.0);
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: PieStart += im->gdes[i].yrule;
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c: if (piechart==2) {
/home/alex/svn/rrdtool-1.2/src/rrd_graph.c:/* copies input untill the first unescaped colon is found
/home/alex/svn/rrdtool-1.2/src/rrd_graph.h:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph.h:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph.h: long piesize; /* size of the piechart */
/home/alex/svn/rrdtool-1.2/src/rrd_graph.h:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph.h: long pie_x,pie_y; /* where is the centerpoint */
/home/alex/svn/rrdtool-1.2/src/rrd_graph.h:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph.h:void pie_part(image_desc_t *, gfx_color_t, double, double, double, double, double);
/home/alex/svn/rrdtool-1.2/src/rrd_graph.h:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph_helper.c:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph_helper.c:#ifdef WITH_PIECHART
/home/alex/svn/rrdtool-1.2/src/rrd_graph_helper.c:#ifdef WITH_PIECHART
--
Alex van den Bogaerdt
http://www.vandenbogaerdt.nl/rrdtool/
More information about the rrd-developers
mailing list