Coin de Gamma
12 months ago
6 changed files with 89 additions and 18 deletions
@ -0,0 +1,47 @@
|
||||
<!DOCTYPE html> |
||||
<html> |
||||
<head> |
||||
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> |
||||
<meta content="utf-8" http-equiv="encoding"> |
||||
|
||||
<script src="../dist/index.dev.js" type="text/javascript"></script> |
||||
</head> |
||||
<body> |
||||
<div id="chart" style="width: 100%; height: 500px;"></div> |
||||
|
||||
<script type="text/javascript"> |
||||
const startTime = 1701790172908; |
||||
const timeSerieData = [5, 6, 3, 7, 5, 6, 8, 4, 5, 6, 4, 3, 5, 7, 8] |
||||
.map((el, idx) => [startTime + idx * 1000, el]); |
||||
// TODO: make this one-dimensinal data when implemented |
||||
const markersData = [3, 6, 9].map(el => [ |
||||
startTime + el * 1000, |
||||
{ el } |
||||
]); |
||||
let options = { |
||||
renderLegend: false, |
||||
axis: { |
||||
y: { range: [0, 10] }, |
||||
x: { format: 'time' } |
||||
}, |
||||
} |
||||
var pod = new LinePod( |
||||
document.getElementById('chart'), |
||||
[ |
||||
{ datapoints: timeSerieData, color: 'black' }, |
||||
], |
||||
options, |
||||
{ |
||||
series: [ |
||||
{ data: markersData, color: 'red' }, |
||||
], |
||||
events: { |
||||
onMouseMove: (el) => { console.log(el); }, |
||||
onMouseOut: () => { console.log('mouse out'); } |
||||
} |
||||
} |
||||
); |
||||
pod.render(); |
||||
</script> |
||||
</body> |
||||
</html> |
@ -1,5 +1,15 @@
|
||||
export type MarkerElem = [number, any?]; |
||||
|
||||
export type MarkerSerie = { |
||||
color: string; |
||||
// TODO: make one-dimensional array with only x
|
||||
data: [number, any?][] // [x, payload] payload is any data for tooltip
|
||||
data: MarkerElem[] // [x, payload] payload is any data for tooltip
|
||||
} |
||||
|
||||
export type MarkersConf = { |
||||
series: MarkerSerie[], |
||||
events?: { |
||||
onMouseMove?: (el: MarkerElem) => void; |
||||
onMouseOut?: () => void; |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue