-
Notifications
You must be signed in to change notification settings - Fork 19.8k
Closed as not planned
Labels
enThis issue is in EnglishThis issue is in Englishnew-featurependingWe are not sure about whether this is a bug/new feature.We are not sure about whether this is a bug/new feature.staleInactive for a long time. Will be closed in 7 days.Inactive for a long time. Will be closed in 7 days.
Description
What problem does this feature solve?
Hello:
Users can draw any tangent line in the graph based on adding a line graphic with the result of a "brush" event
The following is an example:
// TODO: Initial values should be 0
let xStart = 317; // These values need to be updated while the brush ends
let xEnd = 576;
let yStart = 123;
let yEnd = 320;
option = {
xAxis: {
type: 'value'
},
yAxis: {
type: 'value'
},
dataZoom: [
{
type: 'inside',
filterMode: 'none'
},
{
type: 'inside',
orient: 'vertical',
filterMode: 'none'
}
],
brush: {
toolbox: ['rect', 'clear'],
brushType: 'rect',
transformable: false,
removeOnClick: false
},
graphic: [{
type: 'line',
shape: {
x1: xStart,
y1: yStart,
x2: xEnd,
y2: yEnd
},
style: {
lineWidth: 2,
stroke: 'red'
}
}],
series: [
{
data: [
[1, 150],
[2, 230],
[3, 224],
[4, 218],
[5, 135],
[6, 147],
[7, 260]
],
type: 'line',
smooth: true,
}
]
};
myChart.on('brushend', (param: any) => {
console.log(param);
xStart = param.areas[0].range[0][0]
xEnd = param.areas[0].range[0][1]
yStart = param.areas[0].range[1][0]
yEnd = param.areas[0].range[1][1]
console.log(xStart, xEnd, yStart, yEnd);
});Expected results are as follows:
** But this example needs to be running in a React application since xStart, xEnd, yStart and yEnd need to be stored in states. **
What does the proposed API look like?
Maybe we could add a drawDiagonalLine to the options for brush like:
brush: {
toolbox: ['rect', 'clear'],
brushType: 'rect',
transformable: false,
removeOnClick: false,
drawDiagonalLine: true // Default false.
},
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enThis issue is in EnglishThis issue is in Englishnew-featurependingWe are not sure about whether this is a bug/new feature.We are not sure about whether this is a bug/new feature.staleInactive for a long time. Will be closed in 7 days.Inactive for a long time. Will be closed in 7 days.
