100pah opened a new pull request, #20873:
URL: https://github.com/apache/echarts/pull/20873
<!-- Please fill in the following information to help us review your PR more
efficiently. -->
## Brief Information
This pull request is in the type of:
- [ ] bug fixing
- [ ] new feature
- [x] others
Enhance testHelper.js: support:
- range input
- select input
- br to change line
## Usage exmple
```js
var chart = testHelper.create(echarts, 'main_xNumber_yNumber_axis', {
title: [
'xxxx',
'xxxx',
],
option: option,
buttons: [{
text: 'x inverse:',
type: 'select',
values: [false, true],
onchange: function () {
chart.setOption({xAxis: {inverse: this.value}});
}
}, {
type: 'br'
}, {
text: 'xAxis.axisLabel.rotate',
type: 'range',
value: 0,
min: -100,
max: 100,
onchange: function () {
chart.setOption({xAxis: {axisLabel: {rotate: this.value}}});
}
}]
});
```
## The effect
<img width="688" alt="image"
src="https://github.com/user-attachments/assets/5c69af70-ed53-4473-bd81-a3f1c830d3a9"
/>
## Doc
It can be a function that return buttons configuration, like:
buttons: chart => { return [{text: 'xxx', onclick: fn}, ...]; }
Item can be these types:
```js
[{
// A button(default).
text: 'xxx',
// They are the same: `onclick`, `click` (capital insensitive)
onclick: fn
}, {
// A range slider (HTML <input type="range">). Can also be `type:
'slider'`.
type: 'range',
text: 'xxx', // Optional
min: 0, // Optional
max: 100, // Optional
value: 30, // Optional. Must be a number.
step: 1, // Optional
// They are the same: `oninput` `input`
// `onchange` `change`
// `onselect` `select` (capital insensitive)
onchange: function () { console.log(this.value); }
}, {
// A select (HTML <select>...</select>).
type: 'select', // Or `selection`
options: ['a', 'b', 'c'], // Or [{text: 'a', value: 123}, ...].
// Can be any type, like `true`, `123`, etc.
// They are the same: `options: []`, `values:
[]`, `items: []`.
valueIndex: 0, // Optional. The initial value index. By default, the
first option.
value: 'c', // Optional. The initial value. By default, the first option.
// Can be any type, like `true`, `123`, etc.
// But can only be JS primitive type, as `===` is used
internally.
text: 'xxx', // Optional.
// They are the same: `oninput` `input`
// `onchange` `change`
// `onselect` `select` (capital insensitive)
onchange: function () { console.log(this.value); }
}, {
// A line break.
// They are the same: `br` `lineBreak` `break` `wrap` `newLine`
`endOfLine` `carriageReturn`
// `lineFeed` `lineSeparator` `nextLine` (capital
insensitive)
type: 'br',
},
// ...
]
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]