Chart.Scatter icon indicating copy to clipboard operation
Chart.Scatter copied to clipboard

documentation for xScaleOverride options

Open brumm opened this issue 9 years ago • 9 comments

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 avatar Jan 21 '16 14:01 brumm

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

brumm avatar Jan 21 '16 17:01 brumm

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 avatar Feb 14 '16 09:02 dima117

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

dima117 avatar Feb 14 '16 10:02 dima117

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

brumm avatar Feb 17 '16 16:02 brumm

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

dima117 avatar Feb 17 '16 18:02 dima117

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

  • scaleArgLabel (default is "<%=value%>"),
  • scaleDateFormat (default is "mmm d"),
  • scaleTimeFormat (default is "h:MM"),
  • scaleDateTimeFormat (default is "mmm d, yyyy, hh:MM").

dima117 avatar Feb 17 '16 18:02 dima117

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?

dima117 avatar Mar 02 '16 15:03 dima117

Thanks a lot, I'll check it out asap

brumm avatar Mar 02 '16 17:03 brumm

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

zackliston avatar Mar 17 '16 19:03 zackliston