Re: Split Values with JFreeChart ?

From: ElephantWalker (elephantwalker_at_free.fr)
Date: 08/19/04


Date: 19 Aug 2004 08:53:35 -0700

Rogan Dawes <discard@dawes.za.net> wrote in message news:<cfhuuu$ui2$3@server4.gts.cz>...
> ElephantWalker wrote:
>
> > Hi all,
> >
> > I'm in charge of writing an application that can display a chart, and
> > I'm supposed to use JFreeChart.
> >
> > After watching the sample codes and tryed some stuff, it seems to me
> > that this tool is very powerful for displaying multiple kind of charts
> > from the time you give it a single value.
> >
> > What I want to do is to display a very simple chart (Vertical Bars)
> > with some split values.... I want it to be seen on the chart.
> >
> > For example, a simple matrix like this :
> >
> > Serie1 Serie2
> > Category1 12.0 8.0
> > Category2 10.0 9.0
> >
> >
> > But the value 12.0 is in fact (8.0 + 4.0), so the bar displaying this
> > value on the chart would have two colors, each one corresponding to a
> > value.
> >
> > Anyone got any idea on how to do this ??
> >
> > Thanx.
>
> Your series is actually?
>
> Serie1 Serie2
> Category1 4.0 8.0
> Category2 1.0 9.0
>
> And you want to display it using a stacked bar chart?
>
> The trick is to know how to ask the right questions . . . ;-)
>
> Rogan

Hi Rogan,

Thanx for taking some time to read my request. You're right, the trick
is to know how to ask the right question :) so here it is :

>From the following dataset :

double[][] data = new double[][]
        {{8.1, 6.1, 5.7, 5.6, 5.3, 5.2, 5.1, 5, 4.9, 4.8},
        {3.9, 3.9, 3.7, 3.7, 4, 4, 4.6, 4.4, 3, 4},
        {1.1, 1.0, 2.0, 1.5, 1.2, 1.4, 1.6, 2.1, 1.2, 0.9}};

I build a perfect vertical bart chart, divided in 10 categories, and
each category has 3 values represented in vertical bars.

Something like this (I'm not much of a drawer ;p) :

|
|
|
| __
| ||
| || __
| || __ ||
| ||__|| ||
| |||||| || __
| |||||| ||__||
| |||||| ||||||
| |||||| ||||||
|_______||||||__||||||__... and so on...
         Cat1 Cat2 CatX..... Cat10

good.

Now here is the tricky question :
How do I make each of the bar split into sub-values ?

I don't want the values of a single category (in our example, 3
values) to be added and create a single bar, no, I want each bar of
each category to be detailed in some sub-values.

Something like that (each bar is a kindof stacked bar) :

|
|
|
| __
| ||
| || __
| __ __ ||
| ||__|| __
| |||||| || __
| ||__|| ||__||
| __|||| ||||__
| ||||__ ____||
|_______||||||__||||||__... and so on...
         Cat1 Cat2 CatX..... Cat10



Relevant Pages

  • Re: Trouble with Excel Stacking Bar Graphs
    ... When you add data to a column chart, the added data must have data for each ... Jon Peltier, Microsoft Excel MVP ... "Column 2", and the data is in column 2 of the graph, but I want it to ... How can I control which bar in the bar ...
    (microsoft.public.excel.misc)
  • Break down totals in chart
    ... What you want is a stacked bar chart. ... You can create linked text boxes for the totals. ...
    (microsoft.public.excel.charting)
  • Re: Bar Chart template
    ... Create a clustered column chart. ... On the options tab set the Overlap to 100 and the Gap to 0. ... This will give you the widest possible bar, ... Within each bar, the y-axis scale is fit to match maesurement, but it also display a different color for background. ...
    (microsoft.public.excel.charting)
  • Re: urgently:How to use the control MSChart?
    ... I'm sorry, no, I don't really know anything about the chart control; ... Plus it's easy to draw horizontal lines. ... Here's some code that can draw a bar. ... When you display a data series in stacked bar format, ...
    (microsoft.public.vc.mfc)
  • Re: Finding the Y-Value of Points
    ... data series that make up each chart have the values of the points ... Due to the complex formatting of the charts, ... display the values using Data Labels, so I display them in Text Boxes. ... I got the value associated with each bar from the actual cells ...
    (microsoft.public.excel.programming)