Comments (8)
@lyyb2001
If you want to register an action to an event, please try something like:
extraScript: '''
chart.on('click', (params) => {
chart.dispatchAction({
type:'highlight',
seriesIndex: 1,
dataIndex: 0
});
});
''',
from flutter_echarts.
@lyyb2001
If you want to register an action to an event, please try something like:extraScript: ''' chart.on('click', (params) => { chart.dispatchAction({ type:'highlight', seriesIndex: 1, dataIndex: 0 }); }); ''',
I mean triggered at initialization, not in response to a user's click event
There are two kinds of events in echarts, one is the mouse event, which will be triggered when clicking a figure, and the other is the event triggered after calling dispatchaction
from flutter_echarts.
@lyyb2001
The extraScript is executed before any chart.setOption ( I set this order because we don't know when the real setOption happens in async cases.).
I think this is why your dispatchAction didn't work, for in that time the was no option in the chart.
I have a hack idea, you can wrap your dispatchAction in an async function (setTimeout, etc.) to let it execute after your setOption, like:
extraScript: '''
setTimeout(() => {
chart.dispatchAction(...);
}, 0);
''',
from flutter_echarts.
@lyyb2001
The extraScript is executed before any chart.setOption ( I set this order because we don't know when the real setOption happens in async cases.).
I think this is why your dispatchAction didn't work, for in that time the was no option in the chart.
I have a hack idea, you can wrap your dispatchAction in an async function (setTimeout, etc.) to let it execute after your setOption, like:extraScript: ''' setTimeout(() => { chart.dispatchAction(...); }, 0); ''',
Thank you very much for your answer,i tried,but it still doesn't work!
my code is:
final String options = '''
{
animation: false,
grid: {
top: 70,
},
tooltip: {
trigger: 'axis'
},
toolbox: {
show: true
},
legend: {
y: 'bottom',
data:['Normal']
},
xAxis: {
type: 'category',
data: ['3-18','3-19','3-20','3-21','3-22']
},
yAxis: {
type: 'value',
minInterval: 1
},
series: [{
name: 'Normal',
data: [10,20,30,20,10],
type: 'line',
smooth: true,
itemStyle : {
normal : {
color:'#000000',
}
}
},
]
}
''';
Echarts(
option: options,
extraScript: '''
setTimeout(() => {
chart.dispatchAction({
type:'highlight',
seriesIndex: 0,
dataIndex: 0
});
},3000);
''',
)
from flutter_echarts.
@lyyb2001
Does it work in a web echarts project?
from flutter_echarts.
I'm sorry I made a mistake,Actually, I need to ‘showTip' effect,but i use 'highlight',So without careful observation, the effect is not obvious 。Thank you again for your reply 。This issue can be closed
from flutter_echarts.
By the way, dose it work without the setTimeout or must wrap in the setTimeout?
from flutter_echarts.
tooltip 触发方法后 需要 隐藏 但无法隐藏的问题
tooltip 中 自定义 点击操作 触发以下方法
setTimeout(()=> {
chart.dispatchAction(
{
type: 'hideTip'
}
);
Messager.postMessage(JSON.stringify({
params:params,
}));
},3000);
flutter 端可以接收到post过来的数据 但是 tooltip 不可以隐藏
from flutter_echarts.
Related Issues (20)
- Code srevh
- webview_flutter ^4.0.1 no match HOT 5
- Unsupported operation:Trying to use the default webview implementation for TargetPlatfom.windows butthere isnt a default one See also: https://flutter.dev/docs/testing/errors HOT 1
- 请升级下依赖,比如webview_flutter,谢谢 HOT 2
- Safari is not markPoint compatible
- 界面back的时候flutter_echarts执行了clearCache操作,每次都会报错
- Using svg file
- 使用gauge仪表盘,界面显示空白。请问是什么原因,如何修改
- 在下面这段使用到flutter_echarts的代码中,tooltips里formatter的onclick填入什么样的方法,才能在onMessage中获取到数据?
- Convert Flutter Echarts to pdf from flutter APP HOT 1
- Chart Freeze when we have a more than 1000 data points
- 各位大佬 WebView.destroy() called while WebView is still attached to window 这问题是怎么解决的。。。 HOT 4
- How to use flutter echarts component loading a China map has city location, require a demo.
- Recently change error, Come from javaScript resource.Please solve it in original resource.Thanks. HOT 2
- 安卓设备报错 HOT 1
- Web Added HOT 2
- 这库有极大的适配问题就不该去写出来的,早就该关闭了, HOT 1
- when running the example, there are some issues
- ios 刷新数据,统计图不在当前屏出现白屏 HOT 1
- 报错E/FrameEvents( 9016): updateAcquireFence: Did not find frame. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_echarts.