diff --git a/web/calibrate/XyPlot.ts b/web/calibrate/XyPlot.ts --- a/web/calibrate/XyPlot.ts +++ b/web/calibrate/XyPlot.ts @@ -18,7 +18,7 @@ export class XyPlot extends LitElement { chart!: echarts.ECharts; @property() label: string = ""; @property() data: number[][] = []; - + render() { return html`
@@ -52,10 +52,25 @@ export class XyPlot extends LitElement { clear() { this.data.length = 0; } - + insertPoint(x: number, y: number) { this.data.push([x, y]); this.data.sort((a, b) => a[0] - b[0]); this.chart.setOption({ series: [{ name: "d", data: this.data }] }); } + setXMarklines(lines: { txt: string; x: number }[]) { + const markLineData = (row: { txt: string; x: number }, i: number) => ({ name: row.txt, label: { distance: 10*i, formatter: "{b} {c}", color: "#fff", textBorderWidth: 0 }, xAxis: row.x }); + this.chart.setOption( + { + series: [ + { + name: "d", + markLine: { + data: lines.map(markLineData), + }, + }, + ], + } // + ); + } }