2009/12/12 Jon <juan....@gmail.com>:
> I'm not sure if this is possible, but I'd like to show two data lines
> in a line chart. The x axis is the date that each y value occurred. My
> problem is that the two data lines do not have matching x value dates.
> How can I show both of these on the same line chart?
I think you can use a LineChart with two datasets. If I remember
correctly the datasets do not necessarely need to have the same amount
of points or even have the same x values for the points.
Actually, I haven't need your use case even before so I might be wrong.
The idea is that
> the user can compare two different data sets. From what I understand
> in pycha, I have to define myself the x-axis labels, so would probably
> have to calculate myself, based on the data, which x-axis point gets
> which label. Is there a better way?
There are several ways to tell pycha how to draw the x-axis labels. It
can calculate them based on the datasets, you can give it a range, a
number or ticks or, as you mention, give the full information
manually.
Best regards,
Lorenzo
--
You received this message because you are subscribed to the Google Groups "pycha" group.
To post to this group, send email to py...@googlegroups.com.
To unsubscribe from this group, send email to pycha+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pycha?hl=en.
2009/12/19 Jon Black <juan....@gmail.com>:
> You're right, it will plot multiple data sets even if they have a different
> number of points. I'm not sure yet if I can easily make it plot related data
> sets correctly, putting points with the same x axis value in the correct
> place.
>
> At the moment, I'm having trouble with the auto generation of the x axis
> range. My x axis values do not start from 0, but it seems pychart always
> does. The attached image (screenshot.png) was generated with the following
> data set:
>
> (u'dset1', [(10, 15.800000000000001), (11, 17.899999999999999), (12,
> 25.800000000000001), (13, 27.899999999999999), (14, 12.0), (15, 6.0), (16,
> 3.0)])
>
> As you can see, the x values range from 10 to 16.
>
> Compare this to the second image (screenshot2.png) which was generated from
> the same data set, except the values begin from 0:
>
> (u'dset1', [(0, 15.800000000000001), (1, 17.899999999999999), (2,
> 25.800000000000001), (3, 27.899999999999999), (4, 12.0), (5, 6.0), (6,
> 3.0)])
>
In Pycha the x axis always starts at 0. You can change the tick labels
to print whatever you like but at the moment we suppose both axis do
have a origin at 0.
Adding support for axis origin at other value different than 0 would
not be very hard to do so I'm open for patches to add this.
Best regards,
Lorenzo