dima117 / Chart.Scatter

Scatter chart plugin for Chart.js
http://dima117.github.io/Chart.Scatter
MIT License
97 stars 26 forks source link

documentation for xScaleOverride options #36

Open brumm opened 8 years ago

brumm commented 8 years ago

I was searching for a way to control x-axis labels on a date type scatter chart, and found the undocumented xScale options. However, I'm not sure what I'm expected to pass.

As an example, I'd like to only show a date label at every two weeks.

brumm commented 8 years ago

I think I figured out the values, but setting xScaleOverride: true doesn't seem to change rendering at all, unfortunately.

dima117 commented 8 years ago

Hi,

xScaleOverride option has been added to the documentation, but it only works for numeric scale. In the near future I will try to add this functionality in the date scale too.

dima117 commented 8 years ago

I added support of xScaleOverride option for date scale. Thanks for the feedback!

brumm commented 8 years ago

Hey, thanks for the fix.

I went to try it out today and ran into some problems. These are my options:

xScaleOverride: true,
xScaleSteps: 5,
xScaleStepWidth: 86400000 * 14,
xScaleStartValue: xMin

I'd like to display a label at every two weeks. xMin would be 1439355600000 for example.

The grid in the background looks okay, but there are no labels being generated.

image

It'd be awesome if you could a) document the expected format of the xScale keys b) provide an example on how to do custom xScale rendering

dima117 commented 8 years ago

Hi, could you prepare an example on jsfiddle.net or similar site, so I can use it for debugging?

dima117 commented 8 years ago

You can change xScale (type: "date") label using these options:

dima117 commented 8 years ago

I prepared an example in which labels are displayed in 2 weeks. Please see it https://jsfiddle.net/75m29yhx/2/ Is it a solution of your problem?

brumm commented 8 years ago

Thanks a lot, I'll check it out asap

zackliston commented 8 years ago

@dima117 When do you expect to release the new version with these changes?