ng2-charts icon indicating copy to clipboard operation
ng2-charts copied to clipboard

Multiple line chart in same page

Open osmanraifgunes opened this issue 5 years ago • 0 comments

Reproduction of the problem I have two line chart in page. If changed one of the yaxis of this instances both of them updated :

I have too similar two line chart. So just use a single options json

GraphOptionsBase = {
    spanGaps: false,
    legend: {
      display: false
    },
    maintainAspectRatio: false,
    tooltips: {
      position: 'nearest',
      mode: 'index',
      intersect: false
    },
    layout: {
      padding: {
        left: 24,
        right: 32
      }
    },
    elements: {
      point: {
        radius: 4,
        borderWidth: 2,
        hoverRadius: 4,
        hoverBorderWidth: 2
      }
    },
    scales: {
      xAxes: [
        {
          gridLines: {
            display: false
          },
          ticks: {
            fontColor: 'rgba(0,0,0,0.54)'
          }
        }
      ],
      yAxes: [
        {
          gridLines: {
            tickMarkLength: 16
          },
          ticks: {
            stepSize: 10,
            max: 100,
          }
        }
      ]
    },
    plugins: {
      filler: {
        propagate: false
      }
    }
  };

Then update one of the charts. Because it is the only different part of options.

this.memoryGraph.options.scales.yAxes[0].ticks.max = 1000000;
this.memoryGraph.options.scales.yAxes[0].ticks.stepSize = 100000;

ng2-charts is a port & modification of Chart.js component for Angular 2. Sometimes the issue is related with Chart.js instead of ng2-charts. To confirm, if the issue shows in a pure Chart.js project, it is a issue of Chart.js. Pure Chart.js starting template: https://jsfiddle.net/Hongbo_Miao/mvct2uwo/3/

If the issue does not show in a pure Chart.js project, and shows in a ng2-charts project, please try to provide a minimal demo of the problem. ng2-charts starting template: http://plnkr.co/edit/Ka4NXG3pZ1mXnaN95HX5?p=preview

osmanraifgunes avatar Jan 17 '20 15:01 osmanraifgunes