| Version 3 (modified by lgs, 4 years ago) |
|---|
Release Notes for 0.5.0
Pycha 0.5.0 was released the 22th of March, 2009.
Stacked Bar Charts
Pycha now support stacked bar charts. You can see examples of them in the file /trunk/examples/stackedbarchart.py. The new module is called pycha.stackedbarchart and it contains two new charts: StackedVerticalBarChart and StackedHorizontalBarChart.
Custom Colors
One common request among Pycha users was using custom colors in the charts. Until now Pycha always computed the different colors for each dataset by lightening the initial color provided by the user. Now, much powerful and flexible colors can be used.
In the pycha.color module there is a class called ColorScheme. Every subclass of this class is registered in a special registry and available in the chart options under the key colorScheme.name. Pycha now provides three different color schemes but users can write as many as they want. The three different color schemes are:
- Gradient: for old nice pycha colors
- Fixed: for fixed user specified colors
- Rainbow: for rainbow colors
You can use these schemes puting their lowercase names in the key mentioned above. For example, to use the Rainbow color scheme your options would look like:
options = {
'colorScheme': {
'name': 'rainbow',
},
}
If the color scheme needs additional arguments you put them in the colorScheme.args option. For example, the Fixed color scheme needs a list with the colors for each dataset:
options = {
'colorScheme': {
'name': 'fixed',
'args': {
'colors': ['#ff0000', '#00ff00'],
},
},
}
Check the docstring of each Color Scheme subclass to learn about its optional and mandatory arguments.
Important: this feature introduces a backwards imcompatible change because untile Pycha 0.4.2 the option colorScheme was a string and not a dictionary. That string was the initial color used in the old gradient color scheme used by Pycha. You can either remove the key from your options and still get the gradient since it's the default color scheme in Pycha, or update the options like this:
options = {
'colorScheme': {
'name': 'gradient',
'args': {
'initialColor': your_color_here,
},
},
}
Custom fonts in the ticks
Now, it is possible to render the ticks using custom fonts faces and sizes. You could change the axis label before but not the ticks. The relevant options are axis.tickFont and axis.tickFontSize
New interval option
Sometimes you want the axis to render the ticks using a regular interval. Before 0.5.0 you had to compute all the ticks by yourself and give such list to Pycha. Now we have the axis.x.interval and axis.y.inteval options that allows you to set the interval between each tick. These options default to 0 which means they are not used. The ticks, interval and tickCount are mutually exclusive so this mean you can only use one of them. If your options contains two or more of them, their priority is as follows: first ticks, then interval and then tickCount.
Attachments
- vstackedbarchart.png (8.3 kB) - added by lgs 4 years ago.
- gradient.png (31.3 kB) - added by lgs 4 years ago.
- fixed.png (27.9 kB) - added by lgs 4 years ago.
- rainbow.png (32.1 kB) - added by lgs 4 years ago.
