Skip to content

Commit 1f86e35

Browse files
authored
Merge pull request #236 from jerairrest/change-case-chart-instance
rename chart_instance to chartInstance
2 parents 9f7a43e + edaa5da commit 1f86e35

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/index.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class ChartComponent extends React.Component {
4848
}
4949

5050
componentWillMount() {
51-
this.chart_instance = undefined;
51+
this.chartInstance = undefined;
5252
}
5353

5454
componentDidMount() {
@@ -57,7 +57,7 @@ class ChartComponent extends React.Component {
5757

5858
componentDidUpdate() {
5959
if (this.props.redraw) {
60-
this.chart_instance.destroy();
60+
this.chartInstance.destroy();
6161
this.renderChart();
6262
return;
6363
}
@@ -108,7 +108,7 @@ class ChartComponent extends React.Component {
108108
}
109109

110110
componentWillUnmount() {
111-
this.chart_instance.destroy();
111+
this.chartInstance.destroy();
112112
}
113113

114114
transformDataProp(props) {
@@ -149,15 +149,15 @@ class ChartComponent extends React.Component {
149149

150150
const data = this.memoizeDataProps(this.props);
151151

152-
if (!this.chart_instance) return;
152+
if (!this.chartInstance) return;
153153

154154
if (options) {
155-
this.chart_instance.options = Chart.helpers.configMerge(this.chart_instance.options, options);
155+
this.chartInstance.options = Chart.helpers.configMerge(this.chartInstance.options, options);
156156
}
157157

158158
// Pipe datasets to chart instance datasets enabling
159159
// seamless transitions
160-
let currentDatasets = (this.chart_instance.config.data && this.chart_instance.config.data.datasets) || [];
160+
let currentDatasets = (this.chartInstance.config.data && this.chartInstance.config.data.datasets) || [];
161161
const nextDatasets = data.datasets || [];
162162

163163
// use the key provider to work out which series have been added/removed/changed
@@ -192,12 +192,12 @@ class ChartComponent extends React.Component {
192192
newDatasets.forEach(d => currentDatasets.push(d));
193193
const { datasets, ...rest } = data;
194194

195-
this.chart_instance.config.data = {
196-
...this.chart_instance.config.data,
195+
this.chartInstance.config.data = {
196+
...this.chartInstance.config.data,
197197
...rest
198198
};
199199

200-
this.chart_instance.update();
200+
this.chartInstance.update();
201201
}
202202

203203
renderChart() {
@@ -209,7 +209,7 @@ class ChartComponent extends React.Component {
209209
options.legend = legend;
210210
}
211211

212-
this.chart_instance = new Chart(node, {
212+
this.chartInstance = new Chart(node, {
213213
type,
214214
data,
215215
options,
@@ -218,7 +218,7 @@ class ChartComponent extends React.Component {
218218
}
219219

220220
handleOnClick = (event) => {
221-
const instance = this.chart_instance;
221+
const instance = this.chartInstance;
222222

223223
const {
224224
getDatasetAtEvent,
@@ -258,7 +258,7 @@ export class Doughnut extends React.Component {
258258
return (
259259
<ChartComponent
260260
{...this.props}
261-
ref={ref => this.chart_instance = ref && ref.chart_instance}
261+
ref={ref => this.chartInstance = ref && ref.chartInstance}
262262
type='doughnut'
263263
/>
264264
);
@@ -270,7 +270,7 @@ export class Pie extends React.Component {
270270
return (
271271
<ChartComponent
272272
{...this.props}
273-
ref={ref => this.chart_instance = ref && ref.chart_instance}
273+
ref={ref => this.chartInstance = ref && ref.chartInstance}
274274
type='pie'
275275
/>
276276
);
@@ -282,7 +282,7 @@ export class Line extends React.Component {
282282
return (
283283
<ChartComponent
284284
{...this.props}
285-
ref={ref => this.chart_instance = ref && ref.chart_instance}
285+
ref={ref => this.chartInstance = ref && ref.chartInstance}
286286
type='line'
287287
/>
288288
);
@@ -294,7 +294,7 @@ export class Bar extends React.Component {
294294
return (
295295
<ChartComponent
296296
{...this.props}
297-
ref={ref => this.chart_instance = ref && ref.chart_instance}
297+
ref={ref => this.chartInstance = ref && ref.chartInstance}
298298
type='bar'
299299
/>
300300
);
@@ -306,7 +306,7 @@ export class HorizontalBar extends React.Component {
306306
return (
307307
<ChartComponent
308308
{...this.props}
309-
ref={ref => this.chart_instance = ref && ref.chart_instance}
309+
ref={ref => this.chartInstance = ref && ref.chartInstance}
310310
type='horizontalBar'
311311
/>
312312
);
@@ -318,7 +318,7 @@ export class Radar extends React.Component {
318318
return (
319319
<ChartComponent
320320
{...this.props}
321-
ref={ref => this.chart_instance = ref && ref.chart_instance}
321+
ref={ref => this.chartInstance = ref && ref.chartInstance}
322322
type='radar'
323323
/>
324324
);
@@ -330,7 +330,7 @@ export class Polar extends React.Component {
330330
return (
331331
<ChartComponent
332332
{...this.props}
333-
ref={ref => this.chart_instance = ref && ref.chart_instance}
333+
ref={ref => this.chartInstance = ref && ref.chartInstance}
334334
type='polarArea'
335335
/>
336336
);
@@ -342,7 +342,7 @@ export class Bubble extends React.Component {
342342
return (
343343
<ChartComponent
344344
{...this.props}
345-
ref={ref => this.chart_instance = ref && ref.chart_instance}
345+
ref={ref => this.chartInstance = ref && ref.chartInstance}
346346
type='bubble'
347347
/>
348348
);
@@ -354,7 +354,7 @@ export class Scatter extends React.Component {
354354
return (
355355
<ChartComponent
356356
{...this.props}
357-
ref={ref => this.chart_instance = ref && ref.chart_instance}
357+
ref={ref => this.chartInstance = ref && ref.chartInstance}
358358
type='scatter'
359359
/>
360360
);

0 commit comments

Comments
 (0)