React-chartjs-2: Legend on top left

Created on 19 Dec 2017  路  1Comment  路  Source: reactchartjs/react-chartjs-2

How would it be possible to display the legend on the top left corner of the graph?

Would be also good, if the legendCallback would work or there would be a proper documentation.

Most helpful comment

Pass an options object in chart return structure

See code example:

// . . .
render() {
  const options = {
        legend: {
            display: true,
            position: 'left'
        },
  };
    return (
      <div>
        <Line data={this.state.chartData} height="50" options={options} />
      </div>
    )
  }
//  . . .

>All comments

Pass an options object in chart return structure

See code example:

// . . .
render() {
  const options = {
        legend: {
            display: true,
            position: 'left'
        },
  };
    return (
      <div>
        <Line data={this.state.chartData} height="50" options={options} />
      </div>
    )
  }
//  . . .
Was this page helpful?
0 / 5 - 0 ratings

Related issues

n1c01a5 picture n1c01a5  路  4Comments

Holychung picture Holychung  路  4Comments

flavz27 picture flavz27  路  5Comments

Pringels picture Pringels  路  4Comments

pkellner picture pkellner  路  4Comments