|
|
@@ -70,47 +70,47 @@ export function useEchart(el: HTMLElement) {
|
|
|
|
|
|
// 键盘上下左右键控制图表
|
|
|
const onKeyup = (e: KeyboardEvent) => {
|
|
|
- echartMap.forEach((chart) => {
|
|
|
- const datazoom = chart.getOption().dataZoom as echarts.DataZoomComponentOption[];
|
|
|
- if (datazoom && datazoom.length) {
|
|
|
- const start = datazoom[0].start!;
|
|
|
- const end = datazoom[0].end!;
|
|
|
- switch (e.key) {
|
|
|
- case 'ArrowLeft':
|
|
|
- if (start > 0) {
|
|
|
- chart.setOption({
|
|
|
- dataZoom: [
|
|
|
- {
|
|
|
- start: start - 1,
|
|
|
- end: end - 1,
|
|
|
- }
|
|
|
- ]
|
|
|
- });
|
|
|
- }
|
|
|
- break;
|
|
|
- case 'ArrowUp':
|
|
|
- console.log('上');
|
|
|
- break;
|
|
|
- case 'ArrowRight':
|
|
|
- if (end < 100) {
|
|
|
- chart.setOption({
|
|
|
- dataZoom: [
|
|
|
- {
|
|
|
- start: start + 1,
|
|
|
- end: end + 1,
|
|
|
- }
|
|
|
- ]
|
|
|
- });
|
|
|
- }
|
|
|
- break;
|
|
|
- case 'ArrowDown':
|
|
|
- console.log('下');
|
|
|
- break;
|
|
|
- default:
|
|
|
- console.log(e);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
+ // echartMap.forEach((chart) => {
|
|
|
+ // const datazoom = chart.getOption().dataZoom as echarts.DataZoomComponentOption[];
|
|
|
+ // if (datazoom && datazoom.length) {
|
|
|
+ // const start = datazoom[0].start!;
|
|
|
+ // const end = datazoom[0].end!;
|
|
|
+ // switch (e.key) {
|
|
|
+ // case 'ArrowLeft':
|
|
|
+ // if (start > 0) {
|
|
|
+ // chart.setOption({
|
|
|
+ // dataZoom: [
|
|
|
+ // {
|
|
|
+ // start: start - 1,
|
|
|
+ // end: end - 1,
|
|
|
+ // }
|
|
|
+ // ]
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // break;
|
|
|
+ // case 'ArrowUp':
|
|
|
+ // console.log('上');
|
|
|
+ // break;
|
|
|
+ // case 'ArrowRight':
|
|
|
+ // if (end < 100) {
|
|
|
+ // chart.setOption({
|
|
|
+ // dataZoom: [
|
|
|
+ // {
|
|
|
+ // start: start + 1,
|
|
|
+ // end: end + 1,
|
|
|
+ // }
|
|
|
+ // ]
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // break;
|
|
|
+ // case 'ArrowDown':
|
|
|
+ // console.log('下');
|
|
|
+ // break;
|
|
|
+ // default:
|
|
|
+ // console.log(e);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // });
|
|
|
};
|
|
|
|
|
|
const addEventListener = () => {
|