1. Lorenzo Gil
  2. pycha
  3. Issues
Issue #5 resolved

Pie Chart Color Differs From Legend Color

Mark Thomas
created an issue

When I create a pie chart with certain dataset values, the color for one of the data sets does not display properly. It displays gray (the default color when the pie chart is empty) instead of green (the color shown in the legend).

I'm using pycha version 0.5.0 on Windows XP.

I've attached an image that shows the resulting pie chart that gets created.

Here's the dataset that I used:

{{{

!python

receivedLogs = (( 'Messages Received (60)', ((0, 60),) ),
                ( 'Messages Not Received (0)', ((0, 0),) ),
                ( 'Extra Messages Received (200)', ((0, 200),) ))

}}}

Here's the pycha options that I used:

{{{

!python

options = {
    'colorScheme': {
        'name': 'rainbow',
    },
    'legend': {
        'opacity': 0.5,
        'position': {
            'top': 60,
        },
    },
    'stroke': {
        'width': 1,
    },
}

}}}

And here's the API's that I used:

{{{

!python

width, height = ( 500, 300 )
surface = cairo.ImageSurface( cairo.FORMAT_ARGB32, width, height )

chart = PieChart( surface, options )
chart.addDataset( dataSet )
chart.render()
surface.write_to_png( outputFileName )

}}}

Thanks for your help!

--Mark

Comments (2)

  1. Lorenzo Gil repo owner

    The problem seems to be related with the fact that there is a empty set in your dataset (Messages not received). If you take that out the chart is rendered correctly.

    Nevertheless, this is a Pycha bug.

  2. Log in to comment