Vindaar / ggplotnim

A port of ggplot2 for Nim
https://vindaar.github.io/ggplotnim
MIT License
175 stars 15 forks source link

`scale_x/y_date` for string based columns is broken #146

Open Vindaar opened 2 years ago

Vindaar commented 2 years ago

Attempting to assign a scale date to column that stores the dates as strings is currently broken. It never calls the procedure to generate the ticks for it.

In ggplot_ticks in handleTicks we only call the tick procedure handleDateScaleTicks for continuous scales, which only applies for columns that store unix timestamps for example. For string based columns the data is considered discrete and thus we never call it.

However, fixing it requires to fix the logic that finally assigns the position, as the toCoord1D helper needs a data scale, which by default is not available for discrete scales. Maybe we can get away with computing a scale on the fly (based on the data), but possibly this breaks with the drawing logic as that would still think the scale is discrete. So likely we need to turn a date scale into a continuous scale (which causes other problems as of right now). Requires some thought.