1

I'm new to lightweight-chart and have data that 5 minutes apart on each row. Now I need to remove the non market hours - See below. Any option to remove this?

Screenshot

Current chart option

 const chart = createChart(chartContainerRef.current, {
      crosshair: {
        mode: 0, // CrosshairMode.Normal
      },
      layout: {
        background: { type: ColorType.Solid, color: colors.backgroundColor },
        textColor: colors.textColor,
      },
      timeScale: {
        borderColor: "#fff000",
        visible: true,
        timeVisible: true,
        secondsVisible: true,
      },
      width: chartContainerRef.current.clientWidth,
      height: 500,
    });
    chart.timeScale().fitContent();

1 Answers1

1

The library will only add a point on the chart for each data point. So if the data isn't there then it won't be plot.

For example:

  • If you had data points at: 9:00, 9:15, 9:30, 9:45. then the library would plot 4 points.

  • If you remove a point in the middle: 9:00, 9:30, 9:45. then the library would only plot 3 points. There won't be a gap left on the time scale for 9:15.

TLDR; Remove the points you don't want to display from the data before providing it to the library via setData.

SlicedSilver
  • 381
  • 1
  • 4