comparison web/calibrate/XyPlot.ts @ 2419:e3af0ac507c8

new exposure-finder algorithm
author drewp@bigasterisk.com
date Tue, 21 May 2024 14:08:17 -0700
parents ae4b90efb55a
children
comparison
equal deleted inserted replaced
2418:9bb0eb587d5b 2419:e3af0ac507c8
16 `, 16 `,
17 ]; 17 ];
18 chart!: echarts.ECharts; 18 chart!: echarts.ECharts;
19 @property() label: string = ""; 19 @property() label: string = "";
20 @property() data: number[][] = []; 20 @property() data: number[][] = [];
21 21
22 render() { 22 render() {
23 return html` 23 return html`
24 <fieldset> 24 <fieldset>
25 <legend>${this.label}</legend> 25 <legend>${this.label}</legend>
26 <div id="chart"></div> 26 <div id="chart"></div>
50 } 50 }
51 51
52 clear() { 52 clear() {
53 this.data.length = 0; 53 this.data.length = 0;
54 } 54 }
55 55
56 insertPoint(x: number, y: number) { 56 insertPoint(x: number, y: number) {
57 this.data.push([x, y]); 57 this.data.push([x, y]);
58 this.data.sort((a, b) => a[0] - b[0]); 58 this.data.sort((a, b) => a[0] - b[0]);
59 this.chart.setOption({ series: [{ name: "d", data: this.data }] }); 59 this.chart.setOption({ series: [{ name: "d", data: this.data }] });
60 } 60 }
61 setXMarklines(lines: { txt: string; x: number }[]) {
62 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 });
63 this.chart.setOption(
64 {
65 series: [
66 {
67 name: "d",
68 markLine: {
69 data: lines.map(markLineData),
70 },
71 },
72 ],
73 } //
74 );
75 }
61 } 76 }