react-apexcharts
react-apexcharts copied to clipboard
Confusing documentation
I'm using react-apexcharts and I'm looking at this or this for reference. I find examples are
- not working
- confusing (contradictory)
- showing only parts (too less) of code
this readme says this about structure
const options = {
chart: { id: 'apexchart-example'},
xaxis: {categories: [1991, 1992]}
},
const series = [{
name: 'series-1',
data: [30, 40]
}]
// ...
<Chart options={options} series={series} type="bar" width={500} height={320} />
Note:
-
options
andseries
are separated -
options
containsxaxis
- shows a different data structure.
- does not show how to integrate (use) the data.
Code excerpt:
series: [{
data: [{x: 'Apple',y: 54}],
}],
xaxis: {
type: 'category'
}
Note:
- This time
xaxis
is not part ofoptions
- How do I use the
axis
object?
This site introduces curve formatting, but does not explain where to put it.
Code excerpt:
stroke: {
curve: 'straight',
}
Note:
- It has no effect within
series[x]
, nor withinoptions
chart type
The documentation is also not clear about the definition of the chart type.
<ApexChart options={options} series={series} type="area" width="500" />
(from the example in README) produces something like this:
However, moving the type
into series
like this:
const series = [
{
name: 'series-1',
data: [30, 40, 45, 50, 49, 60, 70, 20],
type: 'area,
},
],
<ApexChart options={options} series={series} width="500" />
will create a very different graph:
My hopes
It would be nice, if the documentation could be straightened out to make usage easier.