From 2b73e11fcec4a6218a8d90e5dd21f297b3820086 Mon Sep 17 00:00:00 2001 From: Jacco van den Berg Date: Tue, 23 Feb 2021 12:37:05 +0100 Subject: [PATCH 1/2] data type is correct for all chart types --- docs/docs/charts/bar.mdx | 2 +- docs/docs/charts/line.mdx | 3 ++- docs/docs/charts/radar.mdx | 1 + docs/docs/charts/scatter.mdx | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/docs/charts/bar.mdx b/docs/docs/charts/bar.mdx index 820c65670b3..1f977dbf3b7 100644 --- a/docs/docs/charts/bar.mdx +++ b/docs/docs/charts/bar.mdx @@ -85,7 +85,7 @@ the color of the bars is generally set this way. | [`borderWidth`](#borderwidth) | `number`\|`object` | Yes | Yes | `0` | [`borderRadius`](#borderradius) | `number`\|`object` | Yes | Yes | `0` | [`clip`](#general) | `number`\|`object` | - | - | `undefined` -| [`data`](#data-structure) | `object[]` | - | - | **required** +| [`data`](#data-structure) | `object`\|`object[]`\|`number[]`\|`string[]` | - | - | **required** | [`hoverBackgroundColor`](#interactions) | [`Color`](../general/colors.md) | Yes | Yes | `undefined` | [`hoverBorderColor`](#interactions) | [`Color`](../general/colors.md) | Yes | Yes | `undefined` | [`hoverBorderWidth`](#interactions) | `number` | Yes | Yes | `1` diff --git a/docs/docs/charts/line.mdx b/docs/docs/charts/line.mdx index 3b0e603ea2f..e8b6b682294 100644 --- a/docs/docs/charts/line.mdx +++ b/docs/docs/charts/line.mdx @@ -63,6 +63,7 @@ The line chart allows a number of properties to be specified for each dataset. T | [`borderJoinStyle`](#line-styling) | `string` | Yes | - | `'miter'` | [`borderWidth`](#line-styling) | `number` | Yes | - | `3` | [`clip`](#general) | `number`\|`object` | - | - | `undefined` +| [`data`](#data-structure) | `object`\|`object[]`\|`number[]`\|`string[]` | - | - | **required** | [`cubicInterpolationMode`](#cubicinterpolationmode) | `string` | Yes | - | `'default'` | [`fill`](#line-styling) | `boolean`\|`string` | Yes | - | `false` | [`hoverBackgroundColor`](#line-styling) | [`Color`](../general/colors.md) | Yes | - | `undefined` @@ -197,7 +198,7 @@ Chart.defaults.controllers.line.spanGaps = true; ## Data Structure -See [`Data structures`](../general/data-structures.md) +All of the supported [data structures](../general/data-structures.md) can be used with line charts. ## Stacked Area Chart diff --git a/docs/docs/charts/radar.mdx b/docs/docs/charts/radar.mdx index 06fe80fd378..689a66b40b9 100644 --- a/docs/docs/charts/radar.mdx +++ b/docs/docs/charts/radar.mdx @@ -92,6 +92,7 @@ The radar chart allows a number of properties to be specified for each dataset. | [`hoverBorderJoinStyle`](#line-styling) | `string` | Yes | - | `undefined` | [`hoverBorderWidth`](#line-styling) | `number` | Yes | - | `undefined` | [`clip`](#general) | `number`\|`object` | - | - | `undefined` +| [`data`](#data-structure) | `number[]` | - | - | **required** | [`fill`](#line-styling) | `boolean`\|`string` | Yes | - | `false` | [`label`](#general) | `string` | - | - | `''` | [`order`](#general) | `number` | - | - | `0` diff --git a/docs/docs/charts/scatter.mdx b/docs/docs/charts/scatter.mdx index d67f05696ba..d96d9a0fce6 100644 --- a/docs/docs/charts/scatter.mdx +++ b/docs/docs/charts/scatter.mdx @@ -50,7 +50,7 @@ function example() { ## Dataset Properties The scatter chart supports all of the same properties as the [line chart](./charts/line.mdx#dataset-properties). -By default, the scatter chart will override the showLine property of the line chart to `false`. +By default, the scatter chart will override the showLine property of the line chart to `false` and the type for the data array has changed to `object[]`. ## Data Structure From 6d51b818ab2d0b4705f19a25c8f4055f0b9f263f Mon Sep 17 00:00:00 2001 From: Jacco van den Berg Date: Tue, 23 Feb 2021 20:09:43 +0100 Subject: [PATCH 2/2] implement feedback --- docs/docs/charts/scatter.mdx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/docs/charts/scatter.mdx b/docs/docs/charts/scatter.mdx index d96d9a0fce6..372b91d0111 100644 --- a/docs/docs/charts/scatter.mdx +++ b/docs/docs/charts/scatter.mdx @@ -50,7 +50,9 @@ function example() { ## Dataset Properties The scatter chart supports all of the same properties as the [line chart](./charts/line.mdx#dataset-properties). -By default, the scatter chart will override the showLine property of the line chart to `false` and the type for the data array has changed to `object[]`. +By default, the scatter chart will override the showLine property of the line chart to `false`. + +The index scale is of the type `linear`. This means if you are using the labels array the values have to be numbers or parsable to numbers, the same applies to the object format for the keys. ## Data Structure