Open jobevers opened 11 years ago
Yeahhhhh that needs to get fixed in data.py to something like the following:
if isinstance(data, (list, tuple)):
data = [(x, y) for x, y in enumerate(data)]
values = [{'idx': item[0], 'col': 'data', 'val': item[1]} for item in data]
I'll try to get to it tonight- if you want to change it and submit the PR, I'll happily pull it in :)
Looking at it again, I think my real issue is that there isn't a way to specify "x/idx" and "y/val" values in the order that you want.
You can pass in a 1-D list for values and are forced to use (0, 1, 2, 3... for the idx) or you can create a dictionary which will mess up the ordering.
A different approach might be to check the input, if its a list or tuple, check if its 1D - if so, enumerate it to create a 2D array. If its already 2D then leave it. If its something else... raise an error.
If its a dictionary, grab the items() to create a 2D array.
On Sun, Sep 8, 2013 at 1:07 PM, Rob Story notifications@github.com wrote:
Yeahhhhh that needs to get fixed in data.py to something like the following:
if isinstance(data, (list, tuple)): data = [(x, y) for x, y in enumerate(data)]
values = [{'idx': item[0], 'col': 'data', 'val': item[1]} for item in data]
I'll try to get to it tonight- if you want to change it and submit the PR, I'll happily pull it in :)
— Reply to this email directly or view it on GitHubhttps://github.com/wrobstory/vincent/issues/54#issuecomment-24025933 .
Going to tackle this tomorrow-this-weekish. I hope.
Order is important with charting; avoid using dictionaries as they are un-ordered. A list of tuples would be better.