Skip to content

How i can render custom axisBottom format like it was possible in 0.79.1 #2809

@PawelGIX

Description

@PawelGIX

Describe/explain the bug
After update nivo to latest version 0.99.0 there is no way to override axis format() function with custom output.
This code won't work anymore on @nnivo/line chart:

      format: (d) => {
          var m = d.toLocaleString("en-GB", { month: "short" });
          
          return (
              <>
                  <tspan fontSize={19}>{m}</tspan>
                  <tspan fontSize={19} y={23} x={0}>
                      {d.getFullYear()}
                  </tspan>
              </>
          );
      },

because the output of this function is casted to a string

This wasn't the case in version 0.79.1.
Unfortunately, this breaks my application. Is there a workaround, or can I restore the previous behavior of this function, i.e., not force conversion to string?

Bug Example

This is how it used to work:
https://codesandbox.io/p/sandbox/distracted-cherry-wxm5xx

There is issue in newer version:
https://codesandbox.io/p/devbox/epic-babycat-hqvf72

Issue is there due this line:

Regards,
Paweł

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions