amcharts3 icon indicating copy to clipboard operation
amcharts3 copied to clipboard

When the value is greater than 1300, the duration start with "0undefined"

Open imunew opened this issue 7 years ago • 8 comments

Step

  • Access https://www.amcharts.com/demos/duration-on-value-axis/
  • Click Open in jsFiddle link, and move to http://jsfiddle.net/
  • Make some duration value greater than 1300
  • Click Run button, and the duration start with "0undefined"

OK (the value below 1300)

amchart_ok

NG (the value greater than 1301)

amchart_ng

imunew avatar Mar 05 '17 14:03 imunew

Thanks for bringing this to our attention.

Will let you know when the fix is available.

martynasma avatar Mar 06 '17 05:03 martynasma

OK, we were able to get to the bottom of it. It's not a bug. Phew ;)

It happens because chart uses custom durationUnits which do not have "DD" unit. This will solve the issue:

    "durationUnits": {
        "DD": "d. ",
        "hh": "h ",
        "mm": "min"
    },

martynasma avatar Mar 07 '17 07:03 martynasma

@martynasma I confirm that to add DD unit to durationUnits solve the issue. But I do not want to use DD unit. I hope "1,301" minutes will be displayed as "21h 41min", simply.

imunew avatar Mar 10 '17 14:03 imunew

You can set the "DD" to the empty string, but it has to be there in the durationUnits.

martynasma avatar Mar 23 '17 06:03 martynasma

@martynasma I set the "DD" to the empty string. So, "1,301" minutes is displayed as "021h 41min"

duration-units-dd

I hope "1,301" minutes will be displayed as "21h 41min", without "DD" setting.

imunew avatar Apr 04 '17 01:04 imunew

In this chart the value axis is set to be a "duration" axis using following setting:

"duration": "mm",

If you want to revert to simple values, simply remove that line.

martynasma avatar Apr 04 '17 05:04 martynasma

@martynasma If I removed the line "duration": "mm",, then "1,301" minutes is displayed as "1,301".

This is not a solution. I would like to talk to another engineer.

imunew avatar Apr 04 '17 07:04 imunew

I'm sorry I did not get your question.

Am I right to assume that you don't want the day part? Just hours and minutes, even if the duration is longer than a day? I.e. "35h 30min"

The chart itself does not have this feature to limit maximum available duration unit.

The workaround would need to be applied through the use of callback functions.

labelFunction for value axis and balloonFunction for graph balloons.

Let me know if you need any assistance with that.

P.S. since you asked for another engineer, I asked my alter ego to respond ;)

martynasma avatar Apr 04 '17 20:04 martynasma