Добавлен проп для установки дэша

This commit is contained in:
goodmice 2022-06-30 09:07:14 +05:00
parent cce35f32ef
commit 4ccab4dec5
4 changed files with 6 additions and 2 deletions

View File

@ -39,6 +39,7 @@ export const renderLine = <DataType extends Record<string, unknown>>(
.transition()
.duration(chart.animDurationMs ?? 0)
.attr('d', line(data as any))
.attr('stroke-dasharray', String(chart.dash ?? ''))
return data
}

View File

@ -27,6 +27,7 @@ export const renderNeedle = <DataType extends Record<string, unknown>>(
.attr('x2', (d: any) => xAxis(chart.x(d)))
.attr('y1', height - offset.bottom - offset.top)
.attr('y2', (d: any) => yAxis(chart.y(d)))
.attr('stroke-dasharray', String(chart.dash ?? ''))
return data
}

View File

@ -35,6 +35,7 @@ export type BaseChartDataset<DataType> = {
animDurationMs?: number
point?: Omit<PointChartDataset, 'type'>
afterDraw?: (d: any) => void
dash?: string | number | [string | number, string | number]
}
export type LineChartDataset = {

View File

@ -107,12 +107,13 @@ const plugins = {
cursor: { enabled: false }
}
const makeDataset = (key, label, color, width, radius) => ({
const makeDataset = (key, label, color, width, radius, dash) => ({
key,
type: 'line',
label,
color,
width,
dash,
yAxis: {
type: 'linear',
accessor: 'depth',
@ -173,7 +174,7 @@ const Tvd = memo(({ idWell: wellId, title, ...other }) => {
return [
makeDataset('withoutNpt', 'Факт без НПВ', '#548CFF', 2, radius),
makeDataset('plan', 'План', '#EB5353', 2, radius),
makeDataset('predict', 'Прогноз', '#BD4291', 1, radius),
makeDataset('predict', 'Прогноз', '#BD4291', 1, radius, [5, 5]),
makeDataset('fact', 'Факт', '#36AE7C', 2, radius),
]
}, [pointsEnabled])