wireservice / leather

Python charting for 80% of humans.
https://leather.readthedocs.io
MIT License
330 stars 30 forks source link

Charts only support text values for X axis #101

Open tf13 opened 7 years ago

tf13 commented 7 years ago

I've run into this attempting to use dates or numbers for the X axis. I can work around it by computing a new column that turns a number or date value into a string ... but should that be necessary?

The error message:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Users/xxx/anaconda/lib/python3.5/site-packages/agate/table/bar_chart.py", line 41, in bar_chart
    chart.add_bars(self, x=value, y=label)
  File "/Users/xxx/anaconda/lib/python3.5/site-packages/leather/chart.py", line 148, in add_bars
    Bars(fill_color)
  File "/Users/xxx/anaconda/lib/python3.5/site-packages/leather/chart.py", line 130, in add_series
    shape.validate_series(series)
  File "/Users/xxx/anaconda/lib/python3.5/site-packages/leather/shapes/bars.py", line 36, in validate_series
    raise ValueError('Bars only support Text values for the X axis.')
ValueError: Bars only support Text values for the X axis.