Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
React API experiment
Implements both the API and example generation to do this:-
const ChartExample = () => { const [options, setOptions] = useState({ // Data: Data to be displayed in the chart data: [ { month: "Jan", avgTemp: 2.3, iceCreamSales: 162000 }, { month: "Mar", avgTemp: 6.3, iceCreamSales: 302000 }, { month: "May", avgTemp: 16.2, iceCreamSales: 800000 }, { month: "Jul", avgTemp: 22.8, iceCreamSales: 1254000 }, { month: "Sep", avgTemp: 14.5, iceCreamSales: 950000 }, { month: "Nov", avgTemp: 8.9, iceCreamSales: 200000 }, ], // Series: Defines which chart type and data to use series: [{ type: "bar", xKey: "month", yKey: "iceCreamSales" }], }); - return <AgCharts options={options} />; + return <AgCharts data={options.data} series={options.series} />; };A more idiomatic usage would be this
https://plnkr.co/edit/EVxOsM4IFk8R8mSC?open=index.jsx
This is backwards compatible - you can still pass
optionsif you wishLonger term we may wish to consider an additional single series API
However, we need to ensure top-level options never conflict with series options - e.g.
titleexists both on the pie series options and top-level options