Replies: 2 comments 5 replies
-
It's hard to tell without full code to test it. As far as I know, a number of labels should match the number of data. But it can be configured to work with different numbers. It's best for you to look at chart.js documentation as they should have it all explained(hopefully) https://www.chartjs.org/docs/2.9.4/axes/cartesian/time.html |
Beta Was this translation helpful? Give feedback.
4 replies
-
I fixed this, in the end. Hadn't imported moment.js Doh Once
And razor looked like:
Chart looked like And all was good. I only lost 6 hours to an import - <3 front end dev |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have some data like this:
I want to plot the date on the X and the number on the Y
If make a struct like:
And have no options, no special setup or anything, just a quick thing to make a dataset and a chart:
I just get a graph with two points on it, which are the first two points in the data:
No X labels or anything.
If I set an options of:
I get a nice fat error in the console either no adapter can be found or an incomplete integration was provided
I tried switching to strings in
yyyyMMddHHmmss
, making the structpublic string X
, setting anOptionsObject=
of:Same error
Switched to using
longs
of the epoch, but I still can't get past that error when Type is "time" - it seems to explode no matter whatI saw in chartJs website they have slightly different looking JSON on the axis pages:
https://www.chartjs.org/docs/latest/axes/cartesian/time.html
It looks more like that JS should have this C# (no XAxes array, just an X obj):
I couldnt get any form of this working either. It goes back to "two points on a graph" mode, which I think means "it's being ignored"
I can get my chart to work if I use
long
and set mytype="linear"
but then the labels are ugly on the X and settingLabels=
seems not to work either. I'd be happy to convert all my times to longs/ticks/sesconds since the first time/whatever is needed if I could override the labels on the axis....but really I'd just like the Time series axes to work.. I noted that the Live Demo has working datetime graphing and I've borrowed large sectiosn of it, to no avail:
It just draws two points at the start and end of the graph, no labels on the axis
If I uncomment the
d.Labels =
call to add the color names labels to the dataset, then I get 6 data points rendered with a name under each color, and theyre at even spaced intervals - it's not what I want, and it's not the right number of data points (dataset has 12)And I really can't understand why the code for the live demo (code: https://github.com/stsrki/Blazorise/blob/master/Demos/Blazorise.Demo/Pages/Tests/LiveChartsPage.razor.cs#L353 - live demo: https://bootstrapdemo.blazorise.com/tests/livecharts ) mentions and uses these Labels - passes them into the AddLabelsDatasetsAndUpdate in HandleRedraw, but these color name labels never appear on any live demo chart, the demo charts just have the time values on them like I want.. What's going on?
Beta Was this translation helpful? Give feedback.
All reactions