Skip to content

Commit f63aaf1

Browse files
committed
Use the appropriate time format for auto tick generation
1 parent 4e349a0 commit f63aaf1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/scales/scale.time.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,9 +774,12 @@ module.exports = Scale.extend({
774774
*/
775775
getLabelCapacity: function(exampleTime) {
776776
var me = this;
777+
var timeOpts = me.options.time;
778+
var displayFormats = timeOpts.displayFormats;
777779

778780
// pick the longest format (milliseconds) for guestimation
779-
var format = me.options.time.displayFormats.millisecond;
781+
var format = displayFormats[timeOpts.unit] || displayFormats.millisecond;
782+
780783
var exampleLabel = me.tickFormatFunction(exampleTime, 0, [], format);
781784
var tickLabelWidth = me.getLabelWidth(exampleLabel);
782785
var innerWidth = me.isHorizontal() ? me.width : me.height;

0 commit comments

Comments
 (0)