You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've successfully used this tool to create some charts. The problem I'm currently running into is that I want to scale my X axis to be more linear instead of the current series scale it's been using.
Checking the chart.js documentation, I found the article on Time. Attempting to replicate that in ChartJSCore, though, is proving to be a challenge. I've found the Time object, which looks like it's supposed to meet this need, but I'm having trouble seeing where in the object graph it's supposed to be slotted into.
The best I've managed is to create a Scale object with a type of time, but the Scale object doesn't have any other reference to time. Searching the codebase, I don't see any reference to Time I can use to insert it into the options. Scales just takes an IList of Scale. Is Time supposed to extend Scale?
An example on how to use this would be extremely helpful.
The text was updated successfully, but these errors were encountered:
Hi @FBueckert, looks like I created the Time object but didn't actually integrate it into the Scale object. My initial thinking is that I'll create a new CartesianTimeScale object which will inherit from Scale and include it in here, I'll then update Scales to accept an IList of Object rather than Scale so this can be set to Scale or one of its derived classes. This feels a bit dirty but I can't really think of another nicer way to do.
If you've got a better idea then let me know or go ahead and submit some changes. I'll probably get a chance to update this around the start of next week.
Looking through the Chart.js documentation, I see what you're trying to do; use the categories as parent objects. Maybe create a CartesianScale object, inherit it from Scale, and the Time object can inherit from the CartesianScale? That would give the added advantage of future cartesian object implementations. An IList of Object has a code smell to it, I agree.
Hi @FBueckert, I've made these changes and published version 1.2 to NuGet. Unfortunately I've had to resort to changing the Tick and Scale classes to objects to allow them to accept the different possible types. It's not possible to have a generic parent class that will accept all child classes (you can cast the children but then you lose all additional attributes), I feel there probably is a better way to do this though so feel free to send me an example or point me towards the relevant documentation if you know of it.
I've updated the test project with examples of using the new scales so hopefully these should give you what you need.
I've successfully used this tool to create some charts. The problem I'm currently running into is that I want to scale my X axis to be more linear instead of the current series scale it's been using.
Checking the chart.js documentation, I found the article on Time. Attempting to replicate that in ChartJSCore, though, is proving to be a challenge. I've found the Time object, which looks like it's supposed to meet this need, but I'm having trouble seeing where in the object graph it's supposed to be slotted into.
The best I've managed is to create a Scale object with a type of time, but the Scale object doesn't have any other reference to time. Searching the codebase, I don't see any reference to Time I can use to insert it into the options. Scales just takes an IList of Scale. Is Time supposed to extend Scale?
An example on how to use this would be extremely helpful.
The text was updated successfully, but these errors were encountered: