@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.
@@ -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 = d3
240
- .line()
241
- .x((d: any) => d.x)
242
- .y((d: any) => d.y)
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)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icij/murmur-next",
3
- "version": "4.8.1",
3
+ "version": "4.8.2",
4
4
  "private": false,
5
5
  "description": "Murmur is ICIJ's Design System for Bootstrap 5 and Vue.js",
6
6
  "author": "promera@icij.org",