Browse Source

Merge pull request 'pod fix' (#37) from strange-updates into main

Reviewed-on: #37
pull/39/head
rozetko 11 months ago
parent
commit
963011b274
  1. 4
      react/ChartwerkLinePod.tsx
  2. 4
      src/components/segments.ts
  3. 2
      src/models/segment.ts

4
react/ChartwerkLinePod.tsx

@ -47,9 +47,11 @@ export function ChartwerkLinePod(props: ChartwerkLinePodProps) {
setPod(newPod);
newPod.render();
} else {
// TODO: actually it's wrong logic with updates
// because it creates new pod anyway
pod.updateData(props.series, props.options);
}
}, [chart, pod, props.id, props.options, props.markersConf, props.segments]);
}, [chart, props.id, props.options, props.markersConf, props.segments]);
// TODO: it's a hack to render the LinePod right after the div appears in DOM
setTimeout(() => {

4
src/components/segments.ts

@ -24,9 +24,9 @@ export class Segments {
protected renderSerie(serie: SegmentSerie) {
serie.data.forEach((d) => {
// @ts-ignore
const startPositionX = pod.state.xScale(d[0]) as number;
const startPositionX = this._state.xScale(d[0]) as number;
// @ts-ignore
const endPositionX = pod.state.xScale(d[1]) as number;
const endPositionX = this._state.xScale(d[1]) as number;
const width = endPositionX - startPositionX // Math.max(endPositionX - startPositionX, MIMIMUM_SEGMENT_WIDTH);
this._d3Holder.append('rect')

2
src/models/segment.ts

@ -1,4 +1,4 @@
export type SegmentSerie = {
color: string;
data: [number, number, any][] // [from, to, payload] payload is any data for tooltip
data: [number, number, any?][] // [from, to, payload?] payload is any data for tooltip
}
Loading…
Cancel
Save