Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom X axis value formatting does not work #534

Closed
flyingmutant opened this issue Jun 18, 2021 · 2 comments
Closed

Custom X axis value formatting does not work #534

flyingmutant opened this issue Jun 18, 2021 · 2 comments

Comments

@flyingmutant
Copy link
Collaborator

When attempting to use an example from https://github.com/leeoniya/uPlot/tree/master/docs#axis--grid-opts, adding

      // [0]:   minimum num secs in found axis split (tick incr)
      // [1]:   default tick format
      // [2-7]: rollover tick formats
      // [8]:   mode: 0: replace [1] -> [2-7], 1: concat [1] + [2-7]
      values: [
      // tick incr          default           year                             month    day                        hour     min                sec       mode
        [3600 * 24 * 365,   "{YYYY}",         null,                            null,    null,                      null,    null,              null,        1],
        [3600 * 24 * 28,    "{MMM}",          "\n{YYYY}",                      null,    null,                      null,    null,              null,        1],
        [3600 * 24,         "{M}/{D}",        "\n{YYYY}",                      null,    null,                      null,    null,              null,        1],
        [3600,              "{h}{aa}",        "\n{M}/{D}/{YY}",                null,    "\n{M}/{D}",               null,    null,              null,        1],
        [60,                "{h}:{mm}{aa}",   "\n{M}/{D}/{YY}",                null,    "\n{M}/{D}",               null,    null,              null,        1],
        [1,                 ":{ss}",          "\n{M}/{D}/{YY} {h}:{mm}{aa}",   null,    "\n{M}/{D} {h}:{mm}{aa}",  null,    "\n{h}:{mm}{aa}",  null,        1],
        [0.001,             ":{ss}.{fff}",    "\n{M}/{D}/{YY} {h}:{mm}{aa}",   null,    "\n{M}/{D} {h}:{mm}{aa}",  null,    "\n{h}:{mm}{aa}",  null,        1],
      ],

to e.g. demos/sine-stream.html results in

Uncaught TypeError: parts[i] is not a function
    at uPlot.iife.js:705
    at uPlot.iife.js:1001
    at Array.map (<anonymous>)
    at Object.values (uPlot.iife.js:974)
    at uPlot.iife.js:3489
    at Array.forEach (<anonymous>)
    at axesCalc (uPlot.iife.js:3444)
    at convergeSize (uPlot.iife.js:2596)
    at _commit (uPlot.iife.js:3703)
@leeoniya
Copy link
Owner

i cannot repro this. can you make a failing jsfiddle?

@flyingmutant
Copy link
Collaborator Author

Sorry, my bad: I should have checked my example better. The issue was caused by occurrence of invalid format string ({hh}) inside values. Thank you for the quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants