You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Chart component props can be passed in its **options** property object:
157
+
158
+
```javascript
159
+
<Chart
160
+
options={{
161
+
data,
162
+
primaryAxis,
163
+
secondaryAxes,
164
+
}}
165
+
/>
166
+
```
167
+
168
+
The data property should be an array of series, each series should be an array of objects.
169
+
Each object should have two properties, by convention called primary and secondary, but it can be named as you want. One of these properties will be used as the primary axis and the other as the secondary axes.
170
+
171
+
```javascript
172
+
constdata= [
173
+
{
174
+
label:'Series 1',
175
+
data: [
176
+
{
177
+
primary:'2022-02-03T00:00:00.000Z',
178
+
likes:130,
179
+
},
180
+
{
181
+
primary:'2022-03-03T00:00:00.000Z',
182
+
likes:150,
183
+
},
184
+
],
185
+
},
186
+
{
187
+
label:'Series 2',
188
+
data: [
189
+
{
190
+
primary:'2022-04-03T00:00:00.000Z',
191
+
likes:200,
192
+
},
193
+
{
194
+
primary:'2022-05-03T00:00:00.000Z',
195
+
likes:250,
196
+
},
197
+
],
198
+
},
199
+
]
200
+
```
201
+
202
+
The **primaryAxis** and **secondaryAxes** options, should have a prop called getValue, which is a getter function that returns the axis value for the datum. Example:
getValue: (datum: { likes: number }) =>datum.likes,
215
+
elementType:'area',
216
+
},
217
+
],
218
+
[]
219
+
)
220
+
```
221
+
222
+
**initialHeight** and **initialWidth** expect a number, a default value is applied for each of those, 300 and 200 respectively. It's important to mention that these options are available SSR onoly. If you'd like to have a custom height and width in the client side you may have a wrapper div that sets the width and height CSS attributes
223
+
224
+
**interactionMode** expect an string wich can be "primary" or "closest". It's been using for the tooltip position. By default, primary is being set.
225
+
226
+
**showVoronoi** expect a boolean, it's a debug option to visualize the interaction click-map that sits on top of the chart.
227
+
228
+
**getSeriesOrder** expect a function, this option will allows you to reorder the series if you want.
229
+
230
+
**primaryCursor** and **secundaryCursor** take the options that configure the line/rectangle that is drawn underneath your cursor when you hover over the chart. When both are used, it produces a kind of cross-hair. Both are set to true by default.
231
+
154
232
### Curve Types
155
233
156
234
All element types that support lines or curves can be configured by passing any `curve` generator function as the `AxisOptions<TDatum>['curve']` option. By default, horizontal and vertical series default to using `monotoneX` and `monotoneY` curves, respectively. More information can be found at [`d3-shape curves`](https://github.com/d3/d3-shape#curves)
0 commit comments