mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
Merge pull request #30289 from iRON5/correct-echarts-options
Enhance echarts options definition
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -46,6 +46,7 @@ npm-debug.log
|
||||
.settings/launch.json
|
||||
.vs
|
||||
.vscode
|
||||
.history
|
||||
|
||||
# yarn
|
||||
yarn.lock
|
||||
|
||||
1036
types/echarts/index.d.ts
vendored
1036
types/echarts/index.d.ts
vendored
File diff suppressed because it is too large
Load Diff
64
types/echarts/options/axis-pointer.d.ts
vendored
Normal file
64
types/echarts/options/axis-pointer.d.ts
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
declare namespace echarts {
|
||||
namespace EChartOption {
|
||||
/**
|
||||
* @todo describe
|
||||
*/
|
||||
interface AxisPointer extends BasicComponents.CartesianAxis.Pointer {
|
||||
/**
|
||||
* Component ID, not specified by default.
|
||||
* If specified, it can be used to refer the component
|
||||
* in option or API.
|
||||
*/
|
||||
id?: string;
|
||||
|
||||
/**
|
||||
* axisPointers can be linked to each other.
|
||||
* The term 'link' represents that axes are synchronized
|
||||
* and move together.
|
||||
* Axes are linked according to the value of axisPointer.
|
||||
* See
|
||||
* [sampleA](https://ecomfe.github.io/echarts-examples/public/view.html?c=candlestick-brush&edit=1&reset=1)
|
||||
* and
|
||||
* [sampleB](https://ecomfe.github.io/echarts-examples/public/view.html?c=scatter-nutrients-matrix&edit=1&reset=1).
|
||||
* link is an array, where each item represents a 'link group'.
|
||||
* Axes will be linked when they are refered
|
||||
* in the same link group.
|
||||
*
|
||||
* @example:
|
||||
* link: [
|
||||
* {
|
||||
* // All axes with xAxisIndex 0, 3, 4 and yAxisName 'sameName' will be linked.
|
||||
* xAxisIndex: [0, 3, 4],
|
||||
* yAxisName: 'someName'
|
||||
* },
|
||||
* {
|
||||
* // All axes with xAxisId 'aa', 'cc' and all angleAxis will be linked.
|
||||
* xAxisId: ['aa', 'cc'],
|
||||
* angleAxis: 'all'
|
||||
* },
|
||||
* ...
|
||||
* ]
|
||||
*
|
||||
* @see https://ecomfe.github.io/echarts-doc/public/en/option.html#axisPointer.link
|
||||
*/
|
||||
link?: object[];
|
||||
|
||||
/**
|
||||
* Conditions to trigger tooltip.
|
||||
* Options:
|
||||
* + `'mousemove'` - Trigger when mouse moves.
|
||||
* + `'click'` - Trigger when mouse clicks.
|
||||
* + `'mousemove|click'` - Trigger when mouse clicks and moves.
|
||||
* `'none'` - Do not triggered by `'mousemove'` and `'click'`.
|
||||
* Tooltip can be triggered and hidden manually by calling
|
||||
* `action.tooltip.showTip` and `action.tooltip.hideTip`.
|
||||
* It can also be triggered by `axisPointer.handle` in this case.
|
||||
*
|
||||
* This attribute is new to ECharts 3.0.
|
||||
*
|
||||
* @default 'mousemove|click'
|
||||
*/
|
||||
triggerOn?: 'mousemove' | 'click' | 'mousemove|click' | 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
106
types/echarts/options/data-zoom.d.ts
vendored
Normal file
106
types/echarts/options/data-zoom.d.ts
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
declare namespace echarts {
|
||||
namespace EChartOption {
|
||||
/**
|
||||
* Data zoom component of inside type.
|
||||
* Refer to dataZoom for more information.
|
||||
* The inside means it's inside the coordinates.
|
||||
* Translation: data area can be translated when moving in coordinates.
|
||||
* Scaling:
|
||||
* PC: when mouse rolls (similar with touch pad) in coordinates.
|
||||
* Mobile: when touches and moved with two fingers in coordinates
|
||||
* on touch screens.
|
||||
*
|
||||
* @todo describe
|
||||
* @see https://ecomfe.github.io/echarts-doc/public/en/option.html#dataZoom-inside
|
||||
* @see https://ecomfe.github.io/echarts-doc/public/en/option.html#dataZoom-slider
|
||||
*/
|
||||
type DataZoom = DataZoom.Inside
|
||||
| DataZoom.Slider;
|
||||
|
||||
namespace DataZoom {
|
||||
/**
|
||||
* Data zoom component of inside type.
|
||||
* Refer to dataZoom for more information.
|
||||
* The inside means it's inside the coordinates.
|
||||
* Translation: data area can be translated when moving in coordinates.
|
||||
* Scaling:
|
||||
* PC: when mouse rolls (similar with touch pad) in coordinates.
|
||||
* Mobile: when touches and moved with two fingers in coordinates
|
||||
* on touch screens.
|
||||
*
|
||||
* @see https://ecomfe.github.io/echarts-doc/public/en/option.html#dataZoom-inside
|
||||
*/
|
||||
interface Inside {
|
||||
type?: string;
|
||||
id?: string;
|
||||
disable?: boolean;
|
||||
xAxisIndex?: number | number[];
|
||||
yAxisIndex?: number | number[];
|
||||
radiusAxisIndex?: number | number[];
|
||||
angleAxisIndex?: number | number[];
|
||||
filterMode?: 'filter' | 'weakFilter' | 'empty' | 'none';
|
||||
start?: number;
|
||||
end?: number;
|
||||
startValue?: number | string | Date;
|
||||
endValue?: number | string | Date;
|
||||
minSpan?: number;
|
||||
maxSpan?: number;
|
||||
minValueSpan?: number | string | Date;
|
||||
maxValueSpan?: number | string | Date;
|
||||
orient?: string;
|
||||
zoomLock?: boolean;
|
||||
throttle?: number;
|
||||
rangeMode?: string[];
|
||||
zoomOnMouseWheel?: boolean;
|
||||
moveOnMouseMove?: boolean;
|
||||
moveOnMouseWheel?: boolean;
|
||||
preventDefaultMouseMove?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://ecomfe.github.io/echarts-doc/public/en/option.html#dataZoom-slider
|
||||
*/
|
||||
interface Slider {
|
||||
type?: string;
|
||||
id?: string;
|
||||
show?: boolean;
|
||||
backgroundColor?: string;
|
||||
dataBackground?: object;
|
||||
fillColor?: string;
|
||||
borderColor?: string;
|
||||
handleIcon?: string;
|
||||
handleSize?: number;
|
||||
handleStyle?: object;
|
||||
labelPrecision?: number;
|
||||
labelFormatter?: string | Function;
|
||||
showDetail?: boolean;
|
||||
showDataShadow?: string;
|
||||
realtime?: boolean;
|
||||
textStyle?: object;
|
||||
xAxisIndex?: number | number[];
|
||||
yAxisIndex?: number | number[];
|
||||
radiusAxisIndex?: number | number[];
|
||||
angleAxisIndex?: number | number[];
|
||||
filterMode?: 'filter' | 'weakFilter' | 'empty' | 'none';
|
||||
start?: number;
|
||||
end?: number;
|
||||
startValue?: number | string | Date;
|
||||
endValue?: number | string | Date;
|
||||
minSpan?: number;
|
||||
maxSpan?: number;
|
||||
minValueSpan?: number | string | Date;
|
||||
maxValueSpan?: number | string | Date;
|
||||
orient?: 'vertical' | 'horizontal';
|
||||
zoomLock?: boolean;
|
||||
throttle?: number;
|
||||
rangeMode?: string[];
|
||||
zlevel?: number;
|
||||
z?: number;
|
||||
left?: string | number;
|
||||
top?: string | number;
|
||||
right?: string | number;
|
||||
bottom?: string | number;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
16598
types/echarts/options/series/bar.d.ts
vendored
Normal file
16598
types/echarts/options/series/bar.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
13256
types/echarts/options/series/boxplot.d.ts
vendored
Normal file
13256
types/echarts/options/series/boxplot.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
13491
types/echarts/options/series/candlestick.d.ts
vendored
Normal file
13491
types/echarts/options/series/candlestick.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
7956
types/echarts/options/series/custom.d.ts
vendored
Normal file
7956
types/echarts/options/series/custom.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
16799
types/echarts/options/series/effect-scatter.d.ts
vendored
Normal file
16799
types/echarts/options/series/effect-scatter.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
16496
types/echarts/options/series/funnel.d.ts
vendored
Normal file
16496
types/echarts/options/series/funnel.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
14272
types/echarts/options/series/gauge.d.ts
vendored
Normal file
14272
types/echarts/options/series/gauge.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
22096
types/echarts/options/series/graph.d.ts
vendored
Normal file
22096
types/echarts/options/series/graph.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
15355
types/echarts/options/series/heatmap.d.ts
vendored
Normal file
15355
types/echarts/options/series/heatmap.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
17089
types/echarts/options/series/line.d.ts
vendored
Normal file
17089
types/echarts/options/series/line.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
14937
types/echarts/options/series/lines.d.ts
vendored
Normal file
14937
types/echarts/options/series/lines.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
16406
types/echarts/options/series/map.d.ts
vendored
Normal file
16406
types/echarts/options/series/map.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1336
types/echarts/options/series/parallel.d.ts
vendored
Normal file
1336
types/echarts/options/series/parallel.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
17964
types/echarts/options/series/pictorial-bar.d.ts
vendored
Normal file
17964
types/echarts/options/series/pictorial-bar.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
16224
types/echarts/options/series/pie.d.ts
vendored
Normal file
16224
types/echarts/options/series/pie.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
5585
types/echarts/options/series/radar.d.ts
vendored
Normal file
5585
types/echarts/options/series/radar.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
5259
types/echarts/options/series/sankey.d.ts
vendored
Normal file
5259
types/echarts/options/series/sankey.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
16830
types/echarts/options/series/scatter.d.ts
vendored
Normal file
16830
types/echarts/options/series/scatter.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
12296
types/echarts/options/series/sunburst.d.ts
vendored
Normal file
12296
types/echarts/options/series/sunburst.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2491
types/echarts/options/series/theme-river.d.ts
vendored
Normal file
2491
types/echarts/options/series/theme-river.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
6965
types/echarts/options/series/tree.d.ts
vendored
Normal file
6965
types/echarts/options/series/tree.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
14365
types/echarts/options/series/treemap.d.ts
vendored
Normal file
14365
types/echarts/options/series/treemap.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
24
types/echarts/options/text-style.d.ts
vendored
Normal file
24
types/echarts/options/text-style.d.ts
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
declare namespace echarts {
|
||||
namespace EChartOption {
|
||||
/**
|
||||
* @todo describe
|
||||
*/
|
||||
interface TextStyle {
|
||||
color?: string;
|
||||
fontStyle?: 'normal' | 'italic' | 'oblique';
|
||||
fontWeight?: 'normal' | 'bold' | 'bolder' | 'lighter'
|
||||
| '100' | '200' | '300' | '400';
|
||||
fontFamily?: string;
|
||||
fontSize?: number;
|
||||
lineHeight?: number;
|
||||
width?: number | string;
|
||||
height?: number | string;
|
||||
textBorderColor?: string;
|
||||
textBorderWidth?: number;
|
||||
textShadowColor?: string;
|
||||
textShadowBlur?: number;
|
||||
textShadowOffsetX?: number;
|
||||
textShadowOffsetY?: number;
|
||||
}
|
||||
}
|
||||
}
|
||||
443
types/echarts/options/tooltip.d.ts
vendored
Normal file
443
types/echarts/options/tooltip.d.ts
vendored
Normal file
@@ -0,0 +1,443 @@
|
||||
declare namespace echarts {
|
||||
namespace EChartOption {
|
||||
interface Tooltip {
|
||||
/**
|
||||
* Whether to show the tooltip component,
|
||||
* including tooltip floating layer and `axisPointer`.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
show?: boolean;
|
||||
|
||||
/**
|
||||
* Type of triggering.
|
||||
* Options:
|
||||
* + `'item'` - Triggered by data item, which is mainly used
|
||||
* for charts that don't have a category axis like scatter
|
||||
* charts or pie charts.
|
||||
* + `'axis'` - Triggered by axes, which is mainly used
|
||||
* for charts that have category axes, like bar charts
|
||||
* or line charts.
|
||||
* ECharts 2.x only supports axis trigger for category axis.
|
||||
* In ECharts 3, it is supported for all types of axes in `grid`
|
||||
* or `polar`. Also, you may assign axis with `axisPointer.axis`.
|
||||
* + `'none'` - Trigger nothing.
|
||||
*
|
||||
* @default 'item'
|
||||
*/
|
||||
trigger?: 'item' | 'axis' | 'none';
|
||||
|
||||
/**
|
||||
* `axisPointer` is a tool for displaying reference line
|
||||
* and axis value under mouse pointer.
|
||||
*
|
||||
* Configuration item for axis indicator.
|
||||
* `tooltip.axisPointer` is like syntactic sugar
|
||||
* of `axisPointer` settings on axes
|
||||
* (for example, `xAxis.axisPointer` or `angleAxis.axisPointer`).
|
||||
* More detailed features can be configured
|
||||
* on `someAxis.axisPointer`.
|
||||
* But in common cases, using `tooltip.axisPinter`
|
||||
* is more convenient.
|
||||
* Notice: configurations of `tooltip.axisPointer` has
|
||||
* lower priority than that of `someAxis.axisPointer`.
|
||||
*
|
||||
* @see https://ecomfe.github.io/echarts-doc/public/en/option.html#tooltip.axisPointer
|
||||
*/
|
||||
axisPointer?: {
|
||||
/**
|
||||
* Indicator type.
|
||||
* Options:
|
||||
* + 'line' line indicator.
|
||||
* + 'shadow' shadow crosshair indicator.
|
||||
* + 'none' no indicator displayed.
|
||||
* + 'cross' crosshair indicator, which is actually
|
||||
* the shortcut of enable two axisPointers
|
||||
* of two orthometric axes.
|
||||
*
|
||||
* @default 'line'
|
||||
*/
|
||||
type?: 'line' | 'shadow' | 'none' | 'cross';
|
||||
|
||||
/**
|
||||
* By default, each coordinate system will automatically
|
||||
* chose the axes whose will display its axisPointer
|
||||
* (category axis or time axis is used by default).
|
||||
*/
|
||||
axis?: 'x' | 'y' | 'radius' | 'angle';
|
||||
|
||||
/**
|
||||
* Whether snap to point automatically.
|
||||
* The default value is auto determined.
|
||||
* This feature usually makes sense in value axis
|
||||
* and time axis, where tiny points
|
||||
* can be seeked automatically.
|
||||
*/
|
||||
snap?: boolean;
|
||||
|
||||
/**
|
||||
* `z` value, which controls order of drawing
|
||||
* graphical components.
|
||||
* Components with smaller `z` values may be overwritten
|
||||
* by those with larger `z` values.
|
||||
*/
|
||||
z?: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* Whether to show the tooltip floating layer,
|
||||
* whose default value is true.
|
||||
* It should be configurated to be `false`,
|
||||
* if you only need tooltip to trigger the event
|
||||
* or show the axisPointer without content.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
showContent?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to show tooltip content all the time.
|
||||
* By default, it will be hidden after `tooltip.hideDelay`.
|
||||
* It can be set to be true to preserve displaying.
|
||||
* This attribute is newly added to ECharts 3.0.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
alwaysShowContent?: boolean;
|
||||
|
||||
/**
|
||||
* Conditions to trigger tooltip.
|
||||
* Options:
|
||||
* + `'mousemove'` - Trigger when mouse moves.
|
||||
* + `'click'` - Trigger when mouse clicks.
|
||||
* + `'mousemove|click'` - Trigger when mouse clicks and moves.
|
||||
* `'none'` - Do not triggered by `'mousemove'` and `'click'`.
|
||||
* Tooltip can be triggered and hidden manually by calling
|
||||
* `action.tooltip.showTip` and `action.tooltip.hideTip`.
|
||||
* It can also be triggered by `axisPointer.handle` in this case.
|
||||
*
|
||||
* This attribute is new to ECharts 3.0.
|
||||
*
|
||||
* @default 'mousemove|click'
|
||||
*/
|
||||
triggerOn?: 'mousemove' | 'click' | 'mousemove|click' | 'none';
|
||||
|
||||
/**
|
||||
* Delay time for showing tooltip, in ms.
|
||||
* No delay by default, and it is not recommended to set.
|
||||
* Only valid when `triggerOn` is set to be `'mousemove'`.
|
||||
*
|
||||
* @default 0
|
||||
*/
|
||||
showDelay?: number;
|
||||
|
||||
/**
|
||||
* Delay time for hiding tooltip, in ms.
|
||||
* It will be invalid when `alwaysShowContent` is `true`.
|
||||
*
|
||||
* @default 100
|
||||
*/
|
||||
hideDelay?: number;
|
||||
|
||||
/**
|
||||
* Whether mouse is allowed to enter the floating layer
|
||||
* of tooltip, whose default value is false.
|
||||
* If you need to interact in the tooltip like with links
|
||||
* or buttons, it can be set as `true`.
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
enterable?: boolean;
|
||||
|
||||
/**
|
||||
* Render mode for tooltip.
|
||||
* By default, it is set to be `'html'` so that extra DOM element
|
||||
* is used for tooltip.
|
||||
* It can also set to be `'richText'` so that the tooltip
|
||||
* will be rendered inside Canvas (SVG rich text is
|
||||
* not implemented yet).
|
||||
* This is very useful for environments that don't have DOM,
|
||||
* such as Wechat applications.
|
||||
*
|
||||
* @default 'html'
|
||||
*/
|
||||
renderMode?: 'html';
|
||||
|
||||
/**
|
||||
* Whether confine tooltip content in the view rect
|
||||
* of chart instance.
|
||||
* Useful when tooltip is cut because of `'overflow: hidden'`
|
||||
* set on outer dom of chart instance, or because of narrow
|
||||
* screen on mobile.
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
confine?: boolean;
|
||||
|
||||
/**
|
||||
* The transition duration of tooltip's animation, in seconds.
|
||||
* When it is set to be 0, it would move closely with the mouse.
|
||||
*
|
||||
* @default 0.4
|
||||
*/
|
||||
transitionDuration?: number;
|
||||
|
||||
/**
|
||||
* The position of the tooltip's floating layer,
|
||||
* which would follow the position of mouse by default.
|
||||
*
|
||||
* Options:
|
||||
* 1. String.
|
||||
* + 'inside' - Center position of the graphic element
|
||||
* where the mouse is in, which is only valid when trigger
|
||||
* is 'item'.
|
||||
* + 'top' - Top position of the graphic element where the mouse
|
||||
* is in, which is only valid when trigger is 'item'.
|
||||
* + 'left' - Left position of the graphic element where the mouse
|
||||
* is in, which is only valid when trigger is 'item'.
|
||||
* + 'right' - Right position of the graphic element where
|
||||
* the mouse is in, which is only valid when trigger is 'item'.
|
||||
* + 'bottom' - Bottom position of the graphic element where
|
||||
* the mouse is in, which is only valid when trigger is 'item'.
|
||||
*
|
||||
* 2. Object - Object with optional properties such as `top`,
|
||||
* `left`, `right` and `bottom` that could be `string` or `number`.
|
||||
* e.g. `{left: 10, top: 30}`, or `{right: '20%', bottom: 40}`
|
||||
*
|
||||
* 3. Array - Display the position of tooltip's floating layer
|
||||
* through array, which supports absolute position
|
||||
* and relative percentage.
|
||||
*
|
||||
* 4. Function.
|
||||
* + Parameters:
|
||||
* + point: Mouse position.
|
||||
* + param: The same as formatter.
|
||||
* + dom: The DOM object of tooltip.
|
||||
* + rect: It is valid only when mouse is on graphic elements,
|
||||
* which stands for a bounding box with x, y, width, and height.
|
||||
* + size: The size of dom echarts container.
|
||||
* For example:
|
||||
* `{contentSize: [width, height], viewSize: [width, height]}`
|
||||
* + Return:
|
||||
* position as `String`, `Array` or `Object` described above
|
||||
*
|
||||
* @see https://ecomfe.github.io/echarts-doc/public/en/option.html#tooltip.position
|
||||
*/
|
||||
position?: Tooltip.Position.Type;
|
||||
|
||||
/**
|
||||
* The content formatter of tooltip's floating layer
|
||||
* which supports string template and callback function.
|
||||
*
|
||||
* Types:
|
||||
* 1. String.
|
||||
* The template variables are `{a}`, `{b}`, `{c}`, `{d}` and `{e}`,
|
||||
* which stands for series name, data name and data value and ect.
|
||||
* When trigger is set to be `'axis'`, there may be data
|
||||
* from multiple series. In this time, series index can be refered
|
||||
* as `{a0}`, `{a1}`, or `{a2}`.
|
||||
* `{a}`, `{b}`, `{c}`, `{d}` have different meanings
|
||||
* for different series types:
|
||||
* + Line (area) charts, bar (column) charts, K charts:
|
||||
* `{a}` for series name,
|
||||
* `{b}` for category name,
|
||||
* `{c}` for data value,
|
||||
* `{d}` for none;
|
||||
* + Scatter (bubble) charts:
|
||||
* `{a}` for series name,
|
||||
* `{b}` for data name,
|
||||
* `{c}` for data value,
|
||||
* `{d}` for none;
|
||||
* + Map:
|
||||
* `{a}` for series name,
|
||||
* `{b}` for area name,
|
||||
* `{c}` for merging data,
|
||||
* `{d}` for none;
|
||||
* + Pie charts, gauge charts, funnel charts:
|
||||
* `{a}` for series name,
|
||||
* `{b}` for data item name,
|
||||
* `{c}` for data value,
|
||||
* `{d}` for percentage.
|
||||
*
|
||||
* 2. Function.
|
||||
* The first parameter params is the data that the formatter needs.
|
||||
* Its format is shown as {Format}
|
||||
* When trigger is `'axis'`, or when tooltip is triggered by
|
||||
* `axisPointer`, params is the data array of multiple series.
|
||||
* `Note`: Using array to present all the parameters in ECharts 2.x
|
||||
* is not supported anymore.
|
||||
* The second parameter ticket is the asynchronous callback flag
|
||||
* which should be used along with the third parameter callback
|
||||
* when it is used.
|
||||
* The third parameter callback is asynchronous callback.
|
||||
* When the content of tooltip is acquired asynchronously,
|
||||
* ticket and htm as introduced above can be used to update tooltip
|
||||
* with callback.
|
||||
*
|
||||
* @example
|
||||
* ```
|
||||
*
|
||||
* //string
|
||||
* formatter: '{b0}: {c0}<br />{b1}: {c1}'
|
||||
*
|
||||
* // function
|
||||
* formatter: function (params, ticket, callback) {
|
||||
* $.get('detail?name=' + params.name, function (content) {
|
||||
* callback(ticket, toHTML(content));
|
||||
* });
|
||||
* return 'Loading';
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
formatter?: string | Tooltip.Formatter;
|
||||
|
||||
/**
|
||||
* The background color of tooltip's floating layer.
|
||||
*
|
||||
* @default 'rgba(50, 50, 50, 0.7)'
|
||||
*/
|
||||
backgroundColor?: string;
|
||||
|
||||
/**
|
||||
* The border color of tooltip's floating layer.
|
||||
*
|
||||
* @default '#333'
|
||||
*/
|
||||
borderColor?: string;
|
||||
|
||||
/**
|
||||
* The border width of tooltip's floating layer.
|
||||
*
|
||||
* @default 0
|
||||
*/
|
||||
borderWidth?: number;
|
||||
|
||||
/**
|
||||
* The floating layer of tooltip space around content.
|
||||
* The unit is px. Default values for each position are 5.
|
||||
* And they can be set to different values with left, right,
|
||||
* top, and bottom.
|
||||
*
|
||||
* @example
|
||||
* // Set padding to be 5
|
||||
* padding: 5
|
||||
* // Set the top and bottom paddings to be 5, and left and right paddings to be 10
|
||||
* padding: [5, 10]
|
||||
* // Set each of the four paddings seperately
|
||||
* padding: [
|
||||
* 5, // up
|
||||
* 10, // right
|
||||
* 5, // down
|
||||
* 10, // left
|
||||
* ]
|
||||
*
|
||||
* @default 5
|
||||
*/
|
||||
padding?: number;
|
||||
|
||||
/**
|
||||
* The text style of tooltip's floating layer.
|
||||
*/
|
||||
textStyle?: {};
|
||||
|
||||
/**
|
||||
* Extra CSS style for floating layer.
|
||||
* The following is an example for adding shadow.
|
||||
*
|
||||
* @example
|
||||
* extraCssText: 'box-shadow: 0 0 3px rgba(0, 0, 0, 0.3);'
|
||||
*/
|
||||
extraCssText?: string;
|
||||
}
|
||||
|
||||
namespace Tooltip {
|
||||
namespace Position {
|
||||
type Type = Position.Str | Position.Obj | (number | string)[] | Position.Fn;
|
||||
|
||||
type Str = 'inside' | 'top' | 'left' | 'right' | 'bottom';
|
||||
|
||||
interface Obj {
|
||||
top?: string | number;
|
||||
right?: string | number;
|
||||
bottom?: string | number;
|
||||
left?: string | number;
|
||||
}
|
||||
|
||||
interface Fn {
|
||||
(
|
||||
point: (number | string)[],
|
||||
params: object | object[],
|
||||
element: HTMLElement,
|
||||
rect: object,
|
||||
size: object,
|
||||
): (number | string)[] | Obj;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The first parameter params is the data that the formatter needs.
|
||||
* Its format is shown as {Format}
|
||||
* When trigger is `'axis'`, or when tooltip is triggered by
|
||||
* `axisPointer`, params is the data array of multiple series.
|
||||
* The content of each item of the array is Format type but, without
|
||||
* `percent` field.
|
||||
*
|
||||
* Note: Using array to present all the parameters in ECharts 2.x
|
||||
* is not supported anymore.
|
||||
* The second parameter ticket is the asynchronous callback flag
|
||||
* which should be used along with the third parameter callback
|
||||
* when it is used.
|
||||
* The third parameter callback is asynchronous callback.
|
||||
* When the content of tooltip is acquired asynchronously,
|
||||
* ticket and htm as introduced above can be used to update tooltip
|
||||
* with callback.
|
||||
*
|
||||
* @example
|
||||
* formatter: function (params, ticket, callback) {
|
||||
* $.get('detail?name=' + params.name, function (content) {
|
||||
* callback(ticket, toHTML(content));
|
||||
* });
|
||||
* return 'Loading';
|
||||
* }
|
||||
*/
|
||||
interface Formatter {
|
||||
(
|
||||
params: Format | Format[],
|
||||
ticket: string,
|
||||
callback: (ticket: string, html: string) => void,
|
||||
): string;
|
||||
}
|
||||
|
||||
interface Format {
|
||||
componentType?: 'series';
|
||||
|
||||
// Series type
|
||||
seriesType?: string;
|
||||
|
||||
// Series index in option.series
|
||||
seriesIndex?: number;
|
||||
|
||||
// Series name
|
||||
seriesName?: string;
|
||||
|
||||
// Data name, or category name
|
||||
name?: string;
|
||||
|
||||
// Data index in input data array
|
||||
dataIndex?: number;
|
||||
|
||||
// Original data as input
|
||||
data?: any;
|
||||
|
||||
// Value of data
|
||||
value?: number | any[];
|
||||
|
||||
// Color of data
|
||||
color?: string;
|
||||
|
||||
// the percentage of pie chart
|
||||
percent?: number;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
39
types/echarts/options/x-axis.d.ts
vendored
Normal file
39
types/echarts/options/x-axis.d.ts
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
declare namespace echarts {
|
||||
namespace EChartOption {
|
||||
/**
|
||||
* The x axis in cartesian(rectangular) coordinate.
|
||||
* Usually a single grid component can place at most 2 x axis,
|
||||
* one on the bottom and another on the top.
|
||||
* offset can be used to avoid overlap when you need to put more
|
||||
* than two x axis.
|
||||
*
|
||||
* @see https://ecomfe.github.io/echarts-doc/public/en/option.html#xAxis
|
||||
*/
|
||||
interface XAxis extends BasicComponents.CartesianAxis {
|
||||
/**
|
||||
* The first x axis in grid defaults to be on the bottom of the grid,
|
||||
* and the second x axis is on the other side against the first x axis.
|
||||
*
|
||||
* @default ''
|
||||
*/
|
||||
position?: 'top' | 'bottom';
|
||||
|
||||
/**
|
||||
* Options:
|
||||
* + 'value' - Numerical axis, suitable for continuous data.
|
||||
* + 'category' Category axis, suitable for discrete category data.
|
||||
* Data should only be set via data for this type.
|
||||
* + 'time' Time axis, suitable for continuous time series data.
|
||||
* As compared to value axis, it has a better formatting for time
|
||||
* and a different tick calculation method.
|
||||
* For example, it decides to use month, week, day or hour for tick
|
||||
* based on the range of span.
|
||||
* + 'log' Log axis, suitable for log data.
|
||||
*
|
||||
* @default 'value'
|
||||
* @see https://ecomfe.github.io/echarts-doc/public/en/option.html#xAxis.type
|
||||
*/
|
||||
type?: BasicComponents.CartesianAxis.Type;
|
||||
}
|
||||
}
|
||||
}
|
||||
37
types/echarts/options/y-axis.d.ts
vendored
Normal file
37
types/echarts/options/y-axis.d.ts
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
declare namespace echarts {
|
||||
namespace EChartOption {
|
||||
/**
|
||||
* The y axis in cartesian(rectangular) coordinate.
|
||||
* Usually a single grid component can place at most 2 y axis,
|
||||
* one on the left and another on the right. offset can be used
|
||||
* to avoid overlap when you need to put more than two y axis.
|
||||
*
|
||||
* @see https://ecomfe.github.io/echarts-doc/public/en/option.html#yAxis
|
||||
*/
|
||||
interface YAxis extends BasicComponents.CartesianAxis {
|
||||
/**
|
||||
* The first y axis in grid defaults to be the left (`'left'`)
|
||||
* of the grid, and the second y axis is on the other side
|
||||
* against the first y axis.
|
||||
*/
|
||||
position?: 'left' | 'right';
|
||||
|
||||
/**
|
||||
* Options:
|
||||
* + 'value' - Numerical axis, suitable for continuous data.
|
||||
* + 'category' Category axis, suitable for discrete category data.
|
||||
* Data should only be set via 'data' for this type.
|
||||
* + 'time' Time axis, suitable for continuous time series data.
|
||||
* As compared to value axis, it has a better formatting for time
|
||||
* and a different tick calculation method.
|
||||
* For example, it decides to use month, week, day or hour for tick
|
||||
* based on the range of span.
|
||||
* + 'log' Log axis, suitable for log data.
|
||||
*
|
||||
* @default 'value'
|
||||
* @see https://ecomfe.github.io/echarts-doc/public/en/option.html#yAxis.type
|
||||
*/
|
||||
type?: BasicComponents.CartesianAxis.Type;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,34 @@
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts"
|
||||
"index.d.ts",
|
||||
"options/axis-pointer.d.ts",
|
||||
"options/data-zoom.d.ts",
|
||||
"options/text-style.d.ts",
|
||||
"options/tooltip.d.ts",
|
||||
"options/x-axis.d.ts",
|
||||
"options/y-axis.d.ts",
|
||||
"options/series/bar.d.ts",
|
||||
"options/series/boxplot.d.ts",
|
||||
"options/series/candlestick.d.ts",
|
||||
"options/series/custom.d.ts",
|
||||
"options/series/effect-scatter.d.ts",
|
||||
"options/series/funnel.d.ts",
|
||||
"options/series/gauge.d.ts",
|
||||
"options/series/graph.d.ts",
|
||||
"options/series/heatmap.d.ts",
|
||||
"options/series/line.d.ts",
|
||||
"options/series/lines.d.ts",
|
||||
"options/series/map.d.ts",
|
||||
"options/series/parallel.d.ts",
|
||||
"options/series/pictorial-bar.d.ts",
|
||||
"options/series/pie.d.ts",
|
||||
"options/series/radar.d.ts",
|
||||
"options/series/sankey.d.ts",
|
||||
"options/series/scatter.d.ts",
|
||||
"options/series/sunburst.d.ts",
|
||||
"options/series/theme-river.d.ts",
|
||||
"options/series/tree.d.ts",
|
||||
"options/series/treemap.d.ts"
|
||||
]
|
||||
}
|
||||
|
||||
56
types/zrender/index.d.ts
vendored
Normal file
56
types/zrender/index.d.ts
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
// Type definitions for zrender 4.0
|
||||
// Project: https://github.com/ecomfe/zrender
|
||||
// Definitions by: Roman <https://github.com/iRON5>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
declare namespace zrender {
|
||||
type X = number;
|
||||
type Y = number;
|
||||
type X2 = number;
|
||||
type Y2 = number;
|
||||
type GlobalCoords = boolean;
|
||||
type ColorStops = Array<{
|
||||
offset: number;
|
||||
color: string;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* x, y, x2, y2 are all percent from 0 to 1
|
||||
*/
|
||||
interface LinearGradient {
|
||||
new (
|
||||
/** @default 0 */
|
||||
x?: X,
|
||||
|
||||
/** @default 0 */
|
||||
y?: Y,
|
||||
|
||||
/** @default 1 */
|
||||
x2?: X2,
|
||||
|
||||
/** @default 0 */
|
||||
y2?: Y2,
|
||||
|
||||
/** @default [] */
|
||||
colorStops?: ColorStops,
|
||||
|
||||
/** @default false */
|
||||
globalCoord?: GlobalCoords,
|
||||
): {
|
||||
type: 'linear';
|
||||
x: X;
|
||||
y: Y;
|
||||
x2: X2;
|
||||
y2: Y2;
|
||||
colorStops: ColorStops;
|
||||
globalCoord: GlobalCoords;
|
||||
|
||||
addColorStop(offset: number, color: string): void;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'zrender' {
|
||||
export = zrender;
|
||||
}
|
||||
22
types/zrender/tsconfig.json
Normal file
22
types/zrender/tsconfig.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts"
|
||||
]
|
||||
}
|
||||
7
types/zrender/tslint.json
Normal file
7
types/zrender/tslint.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-single-declare-module": false,
|
||||
"no-declare-current-package": false
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user