echarts icon indicating copy to clipboard operation
echarts copied to clipboard

Type for datazoom event

Open akopanskiy opened this issue 1 year ago • 2 comments
trafficstars

Version

5.4.3

Link to Minimal Reproduction

No response

Steps to Reproduce

Create datazoom event Try to type

Current Behavior

For example, we have the following code: `myChart.on("dataZoom", event => { if (event.batch) { return dataZoom.value = { start: event.batch[0].start, end: event.batch[0].end }; }

			dataZoom.value = { start: event.start, end: event.end };
		});`

For the event TypeScript gives an error: Argument of type (this: EChartsType, e: unknown) => { start: any; end: any; } | undefined is not assignable to parameter of type WithThisType<(...args: unknown[]) => boolean | void, EChartsType> How to type an event?

Expected Behavior

Environment

- OS: macOS Sonoma
- Browser: Chrome 120.0.6099.129 
- Framework: Vue@3

Any additional comments?

No response

akopanskiy avatar Jan 30 '24 20:01 akopanskiy

Same problem, event has no type defined.

ievgennaida avatar Aug 15 '24 09:08 ievgennaida

The doc is misleading

{
    type: 'datazoom',
    // percentage of zoom start position, 0 - 100
    start: number
    // percentage of zoom finish position, 0 - 100
    end: number
    // data value of zoom start position; only exists in zoom event of triggered by toolbar
    startValue?: number
    // data value of zoom finish position; only exists in zoom event of triggered by toolbar
    endValue?: number
}

Congee avatar May 07 '25 17:05 Congee