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

Feature: Make ranges for tick auto generation configurable

Open andig opened this issue 9 years ago • 13 comments

This is against master (with or without #4545)- notice the Q3 in the middle of the year as well as the thicker first gridline:

screen shot 2017-08-11 at 16 29 32

Here's the associated fiddle: http://jsfiddle.net/andig2/sexq35rn/2/

Looks like an issue with determiniNotice that depends on width of the chart. Maybe the behaviour should already be addressed by any of the open PRs?

andig avatar Aug 11 '17 14:08 andig

The ticker first grid line should be fixed in #4545, I don't know about the Q3 positioning

simonbrunel avatar Aug 11 '17 14:08 simonbrunel

Not fixed by #4545, just retested :(

andig avatar Aug 11 '17 14:08 andig

You right, #4545 fixed it only for the case of options.offset === gridLines.offsetGridLines

simonbrunel avatar Aug 11 '17 15:08 simonbrunel

Might be fixed by #4117 then :) (@Zamaroth is about to rewrite it)

simonbrunel avatar Aug 11 '17 15:08 simonbrunel

#4117 seems to take care of the line formatting: http://jsfiddle.net/andig2/vLgosao7/ but introduces two new problems (I can migrate this comment there):

  • gridline formatting is bc break with current implementation (y axes in the example), this might be fixable by looking at the docs
  • doesn't respect min/max settings on the x axis

andig avatar Aug 11 '17 15:08 andig

the implementation is gonna change and I can assure you it's gonna enable you to change the look of the first horizontal gridLine

Zamaroth avatar Aug 11 '17 15:08 Zamaroth

I don't know about the Q3 positioning

Figured that one out. Its actually correct- middle of the year is the start of the third quarter. It just looks very weird, more so since q2 and q4 are not displayed. Imho this "quarter style" default formatting is more confusing than helpful?

andig avatar Aug 12 '17 17:08 andig

ping @simonbrunel

andig avatar Aug 16 '17 18:08 andig

@andig we should maybe provide a way to customize the available ranges for tick auto generation.

simonbrunel avatar Aug 17 '17 07:08 simonbrunel

Sounds like a good idea, updated title

andig avatar Aug 17 '17 16:08 andig

The first gridline problem is btw also noticable in the time scale point data example.

andig avatar Aug 21 '17 14:08 andig

Thicker first grid line - Fixed by #4700.

Quater style labels - Fixed by #4777 skipping quarters and weeks during the auto tick generation. Because this fiddle is using the master build, now you will see ticks at a 3-month interval with Mar, Jun, Sep and Dec when you make the window larger. If ticks.major.enabled is set to true, ticks will be aligned to the beginning of year like 2015, Apr, Jul and Oct.

nagix avatar May 24 '19 15:05 nagix

If ticks.major.enabled is set to true, ticks will be aligned to the begging of year like 2015, Apr, Jul and Oct.

This is somewhat true today. It will align the first major label. To align all of them we need https://github.com/chartjs/Chart.js/pull/6274

benmccann avatar May 24 '19 15:05 benmccann