New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to give line graph X values a string description #121
Comments
Another (maybe better?) way to accomplish what I need would be to allow a String series for line graphs. Assume each string is just a distance of |
@jentfoo After thinking about this, I don't like the idea of extending So perhaps the solution is to change the Bar Chart into a Category Chart, and be able to set the series type, bar being the default. Then everything is the same except right at the end when the data is drawn, it just checks what to draw and draws either bars or lines, etc. |
Seems resonable. Any idea how much effort it will be? Will the bar graph drawing be able to easily share the line drawing code of the line graphs?? |
Should be around 30 minutes to an hour of coding and testing. I don't think it will be easily able to share. Maybe you could make a |
Adds a new type "category" which is a line graph, but with labels for the x axis rather than scaled numerical values. This is to resolve knowm#121, but still has a few issues. Originally I copied PlotContentLineChart into a new PlotContentCategoryChart, but instead found that with just a few extra conditionals could allow for a large amount of reuse code. There is still an issue where the angle points of the line graph still don't line up right with the X axis lines. The "category" type does have a few restrictions: * Setting a min and max X axis value has no effect * Setting the X axis to be log has no effect * When providing data series the X data points must always match, missing data points for a given series is not currently handled
See |
@timmolter I can make that work. A few considerations with this style:
With your new design the same graph looks like: Is there a way to get the same Y axis scaling? I hate to have to put the logic into my apps, but I can if necessary. |
Also, I do think the X axis lines/grid sometimes makes the graph easier to read. Is it possible to get those back? If not, it's not a huge deal breaker, but I thought I would at least point it out as another difference. It does seem like the line graph design is more of a natural fit for displaying this data? |
@jentfoo all valid points! I'll work on it. Could you submit a PR, with your above plot code? I'd like to use it to create this new feature and add it to my demo. |
I don't see what you mean. Can you show me some how? |
Please try the latest code and run |
@timmolter I just took a look. It looks like it's working fine for my needs! I thought I would point out that the logarithmic setting you have enabled in the demo is causing the Y axis to not draw at all. But as soon as you disable that, it looks great! Would you like me to open a new issue for that (knowing it's not important to me, but may be to others)? |
No, I'll just fix it. Eventually soonish. |
Closing. Logarithmic axes doesn't even make sense for this plot. My bad. |
I think this is a feature request more than anything. I have a need to be able to provide String descriptions for points along the X graph, ideally not even showing the numbers.
A couple thoughts on how to do this would be a possible type that extends
Number
, constructed with a numeric value, and a String which is gathered from .toString(). Then place those .toString() values on the X axis where they belong.In theory the same thing can be done with dates as well.
Let me know your thoughts, if you have ideas on how this could be done easiest, if I have time I could provide a PR.
The text was updated successfully, but these errors were encountered: