@icij/murmur-next 4.8.1 → 4.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/lib/datavisualisations/LineChart/LineChart.vue.d.ts +6 -0
- package/dist/lib/murmur.js +7 -3
- package/dist/lib/murmur.js.map +1 -1
- package/dist/lib/murmur.umd.cjs +1 -1
- package/dist/lib/murmur.umd.cjs.map +1 -1
- package/lib/datavisualisations/LineChart/LineChart.vue +15 -6
- package/package.json +1 -1
|
@@ -83,6 +83,11 @@ export interface LineChartProps {
|
|
|
83
83
|
* Aspect ratio (height/width) for the chart.
|
|
84
84
|
*/
|
|
85
85
|
chartHeightRatio?: number
|
|
86
|
+
/**
|
|
87
|
+
* D3 curve factory for line interpolation (e.g. d3.curveStep, d3.curveMonotoneX).
|
|
88
|
+
* Defaults to d3.curveLinear.
|
|
89
|
+
*/
|
|
90
|
+
curve?: d3.CurveFactory
|
|
86
91
|
/**
|
|
87
92
|
* Enable social mode for optimal display when sharing on social media.
|
|
88
93
|
*/
|
|
@@ -99,6 +104,7 @@ const props = withDefaults(defineProps<LineChartProps>(), {
|
|
|
99
104
|
keys: () => [],
|
|
100
105
|
groups: () => [],
|
|
101
106
|
hideLegend: false,
|
|
107
|
+
curve: undefined,
|
|
102
108
|
fixedLabelWidth: null,
|
|
103
109
|
fixedHeight: null,
|
|
104
110
|
seriesName: 'value',
|
|
@@ -236,10 +242,13 @@ const formattedData = computed(() => {
|
|
|
236
242
|
})
|
|
237
243
|
})
|
|
238
244
|
|
|
239
|
-
const createLine =
|
|
240
|
-
.line()
|
|
241
|
-
.
|
|
242
|
-
|
|
245
|
+
const createLine = computed(() => {
|
|
246
|
+
const generator = d3.line().x((d: any) => d.x).y((d: any) => d.y)
|
|
247
|
+
if (props.curve) {
|
|
248
|
+
generator.curve(props.curve)
|
|
249
|
+
}
|
|
250
|
+
return generator
|
|
251
|
+
})
|
|
243
252
|
|
|
244
253
|
const parseTime = d3.timeParse('%Y')
|
|
245
254
|
|
|
@@ -272,7 +281,7 @@ function update() {
|
|
|
272
281
|
}))
|
|
273
282
|
return {
|
|
274
283
|
key,
|
|
275
|
-
path: createLine(points as any) as unknown as string,
|
|
284
|
+
path: createLine.value(points as any) as unknown as string,
|
|
276
285
|
color: colorScale.value(key)
|
|
277
286
|
}
|
|
278
287
|
})
|
|
@@ -282,7 +291,7 @@ function update() {
|
|
|
282
291
|
x: scale.value.x(d[props.timeseriesKey]),
|
|
283
292
|
y: scale.value.y(d[props.seriesName])
|
|
284
293
|
}))
|
|
285
|
-
line.value = createLine(points as any) as any
|
|
294
|
+
line.value = createLine.value(points as any) as any
|
|
286
295
|
}
|
|
287
296
|
|
|
288
297
|
d3.select(el.value)
|