diff --git a/packages/nivo-line/src/canvas/LineChartCanvas.js b/packages/nivo-line/src/canvas/LineChartCanvas.js
index 253491d64..b9019f950 100644
--- a/packages/nivo-line/src/canvas/LineChartCanvas.js
+++ b/packages/nivo-line/src/canvas/LineChartCanvas.js
@@ -115,12 +115,7 @@ class LineChartCanvas extends Component {
})
}
- renderLegends(ctx, {
- lines,
- legends,
- width,
- height,
- }) {
+ renderLegends(ctx, { lines, legends, width, height }) {
const legendData = lines.map(line => ({
label: line.id,
fill: line.color,
@@ -204,13 +199,14 @@ class LineChartCanvas extends Component {
axisLeft,
})
- enableArea && this.renderAreas(this.ctx, {
- lines,
- generator: areaGenerator,
- xScale,
- yScale,
- opacity: areaOpacity,
- })
+ enableArea &&
+ this.renderAreas(this.ctx, {
+ lines,
+ generator: areaGenerator,
+ xScale,
+ yScale,
+ opacity: areaOpacity,
+ })
this.renderLines(this.ctx, {
lines,
diff --git a/packages/nivo-line/src/compute.js b/packages/nivo-line/src/compute.js
index 42fd9babb..3f08b8d93 100644
--- a/packages/nivo-line/src/compute.js
+++ b/packages/nivo-line/src/compute.js
@@ -20,8 +20,8 @@ import { scalePoint, scaleLinear } from 'd3-scale'
*/
export const getXScale = (data, width, type) => {
if (type === 'linear') {
- const minX = min(data.map(({data}) => min(data.map(d => d.x))))
- const maxX = max(data.map(({data}) => max(data.map(d => d.x))))
+ const minX = min(data.map(({ data }) => min(data.map(d => d.x))))
+ const maxX = max(data.map(({ data }) => max(data.map(d => d.x))))
return scaleLinear()
.range([0, width])
diff --git a/packages/nivo-line/src/svg/LineChartSvg.js b/packages/nivo-line/src/svg/LineChartSvg.js
index cec69acd3..8d2dc242e 100644
--- a/packages/nivo-line/src/svg/LineChartSvg.js
+++ b/packages/nivo-line/src/svg/LineChartSvg.js
@@ -152,7 +152,7 @@ const LineChartSvg = ({
xScale={xScale}
yScale={yScale}
curve={curve}
- size={lineWidth}
+ lineWidth={lineWidth}
style={{
stroke: line.color,
}}
diff --git a/packages/nivo-line/src/svg/LineSvg.js b/packages/nivo-line/src/svg/LineSvg.js
index 3f66c4fdb..fe36423f3 100644
--- a/packages/nivo-line/src/svg/LineSvg.js
+++ b/packages/nivo-line/src/svg/LineSvg.js
@@ -29,7 +29,7 @@ const LineSvg = ({
generator,
xScale,
yScale,
- size,
+ lineWidth,
animate,
motionDamping,
motionStiffness,
@@ -43,7 +43,7 @@ const LineSvg = ({
)
if (animate !== true) {
- return
The responsive alternative of this component is{' '}
- ResponsiveLineChartSvg
.
+ ResponsiveLineChartSvg
, it also offers another implementation, see{' '}
+ LineChartCanvas.
This component is available in the{' '} @@ -93,6 +94,17 @@ export default class LinePage extends Component { the storybook .
+
+ For more advanced features (eg.{' '}
+
+ dual y axis
+ ) or mixing with other chart types, you can also build your own chart using{' '}
+ @nivo/line
low level components.
+
See the dedicated guide on how to setup
legends for this component.
diff --git a/website/src/components/charts/line/LineCanvas/index.js b/website/src/components/charts/line/LineCanvas/index.js
index c7daed8f8..a1bedac44 100644
--- a/website/src/components/charts/line/LineCanvas/index.js
+++ b/website/src/components/charts/line/LineCanvas/index.js
@@ -40,14 +40,14 @@ export default class LinePage extends Component {
const mappedSettings = propsMapper(settings)
- const code = generateCode('ResponsiveLine', mappedSettings, {
+ const code = generateCode('ResponsiveLineChartCanvas', mappedSettings, {
pkg: '@nivo/line',
defaults: LineDefaultProps,
})
const header = (
Line chart with stacking ability.
-
- Given an array of data series having an id and a nested array of points (with x,
- y properties), it will compute the line for each data serie. If stacked is
- true, y values will be automatically aggregated.
- This component also accept empty values, but please note that they must be
- explicitly defined though, eg. {'{ x: 10, y: null }'}
.
-
- The responsive alternative of this component is ResponsiveLine
.
-
- This component is available in the{' '} - - nivo-api - , see{' '} - - sample - {' '} - or try it using the API client. You can also see - more example usages in{' '} - - the storybook - . + A variation around the LineChartSvg component. Well + suited for large data sets as it does not impact DOM tree depth and does not + involve React diffing stuff for children (not that useful when using canvas), + however you'll lose the isomorphic ability and transitions.
- See the dedicated guide on how to setup
- legends for this component.
+ The responsive alternative of this component is{' '}
+ ResponsiveLineChartCanvas
.