0

I am trying to create line chart with react-chart-2 and NextJs, and it seems to work fine on development. But when I build project, I only got line chart with gray background. It very bad, how can I fix it. Thanks

What I want to get: What I want to get

But what I really get: What I really get

My code:

config = {
    data: {
      datasets: [
        {
          data: data ? data : [],
          borderColor: '#ff0000',
          borderWidth: 1,
          radius: 0,
        },
      ],
    },
    // text color "#fff"
    Text: {
      style: {
        color: '#fff',
      },
    },
    options: {
      animation: false,
      interaction: {
        intersect: false,
      },
      plugins: {
        legend: false,
      },
      scales: {
        x: {
          type: 'linear',
          grid: {
            display: false,
            // borderColor: '#fff',
          },
          ticks: {
            display: false,
          },
        },
        y: {
          grid: {
            display: false,
            borderColor: '#fff',
          },
          ticks: {
            display: false,
          },
        },
      },
    },
  },

My component:

<Line
      options={config.options as any}
      data={config.data as any}
    />
vantrong
  • 19
  • 5

0 Answers0