Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions examples/custom/src/App.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import plotly from 'plotly.js/dist/plotly';
import PlotlyEditor from 'react-chart-editor';
import CustomEditor from './CustomEditor';
import {localizeString} from 'react-chart-editor/lib';
import 'react-chart-editor/lib/react-chart-editor.css';

const dataSources = {
Expand Down Expand Up @@ -35,12 +33,6 @@ class App extends Component {
};
}

getChildContext() {
return {
localize: key => localizeString({}, 'en', key),
};
}

render() {
return (
<div className="app">
Expand All @@ -52,9 +44,7 @@ class App extends Component {
dataSources={dataSources}
dataSourceOptions={dataSourceOptions}
plotly={plotly}
onUpdate={(data, layout, frames) =>
this.setState({data, layout, frames})
}
onUpdate={(data, layout, frames) => this.setState({data, layout, frames})}
useResizeHandler
debug
advancedTraceTypeSelector
Expand All @@ -66,8 +56,4 @@ class App extends Component {
}
}

App.childContextTypes = {
localize: PropTypes.func,
};

export default App;
31 changes: 5 additions & 26 deletions examples/custom/src/CustomEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ export default class CustomEditor extends Component {
}
<Info attr="title">
<p>
This custom editor demonstrates the general-purpose container
and field components.
This custom editor demonstrates the general-purpose container and field components.
</p>
<p>
This is an <code>Info</code> component.
Expand All @@ -48,47 +47,27 @@ export default class CustomEditor extends Component {
label="Dropdown"
attr="xaxis.title"
show
options={[
{label: 'Yes', value: 'yes'},
{label: 'No', value: 'no'},
]}
options={[{label: 'Yes', value: 'yes'}, {label: 'No', value: 'no'}]}
/>
<Radio
label="Radio"
attr="yaxis.title"
show
options={[
{label: 'Yes', value: 'yes'},
{label: 'No', value: 'no'},
]}
options={[{label: 'Yes', value: 'yes'}, {label: 'No', value: 'no'}]}
/>
<Flaglist
label="Flaglist"
attr="titlefont.family"
show
options={[
{label: 'Yes', value: 'y'},
{label: 'No', value: 'n'},
]}
options={[{label: 'Yes', value: 'y'}, {label: 'No', value: 'n'}]}
/>
<ColorPicker label="ColorPicker" attr="plot_bgcolor" show />
<TextEditor attr="title" label="TextEditor default" />
<TextEditor
attr="title"
label="TextEditor richTextOnly"
richTextOnly
/>
<TextEditor attr="title" label="TextEditor htmlOnly" htmlOnly />
<TextEditor attr="title" label="TextEditor latexOnly" latexOnly />
</PlotlySection>
</PlotlyFold>
</LayoutPanel>
<SingleSidebarItem>
<Button
variant="primary"
label="save"
onClick={() => alert('save button clicked!')}
/>
<Button variant="primary" label="save" onClick={() => alert('save button clicked!')} />
</SingleSidebarItem>
<SingleSidebarItem>
<Button
Expand Down