Comments (4)
@milochadam
Thanks for your advice. the suggestions are adopted in the new v0.5.1:
- Why always the last point in tooltip is because the selection is defined to select "the whole group", which means all tuples are selected and only shows the last one in a single tuple tooltip.
The solution is that to define another selection also tiggerd by hover, which only select one tuple ( Novariable
property). In old the old version, two selections with same tiggering gesture is not allowed, But we managed to make it possible in the new version and tooltip can be triggerd by more selections. Only be carefull not to define selections with same triggering gesture in one tooltip or element onSelection, which will conflict. - It seems you want to set interactions both for touch and mouse. The selection has a
devices
property to stirct which device it works. Thus you can set hover only for mouse and touch move only for touch. - The tooltip is automatically constrained when it will overflow the chart border. This auto adjustment can be turned off by a
constrained
property of tooltip.
See details in a updated example, which is derived from your example:
graphic/example/lib/pages/line_area.dart
Line 190 in 120a612
from graphic.
I think your requests can all be satisfied by now. Just need a little bit more complex specifications:
- Line with dots: you just need to set both a
LineElement
and aPointElement
inelements
list, here is a similar line with area example:graphic/example/lib/pages/line_area.dart
Line 124 in a52806a
- Custom your dots: inplement your own PointShape for the
shape
attribute, just like this example:graphic/example/lib/pages/custom.dart
Line 216 in a52806a
- Legend: different people have different legend styles in mind, so we think it's not wise to provide a uniform legend component or define configurations for it. Instead, we encourage customizing the legend freely by TagAnnotation and MarkAnnotation, here is the legend example:
graphic/example/lib/pages/custom.dart
Line 340 in a52806a
- Tooltip: we provied a tooltip component TooltipGuide.
Your hover request is a little bit complex, it needs several steps:
- Indicate by which variable you will group the data to get multi-lines. The indicating is implemented by
/
operator in theposition
algebra expression of all Elements. - Define a
PointSelection
which is triggered by hover gesture type. This selection'svariable
property should be the same as that you group the data. Then when you hover a dot, all data in the same group will be regarded as "selected", and other group datas as "unselected". - define there tag and color change in element's
onSelection
property.
Here is a similar but simpler example that may help:graphic/example/lib/pages/point.dart
Line 55 in a52806a
The specifications of this library need some efforts to learn. Please see details in the document and exaple app. But we promise it worth the efforts.
from graphic.
Thank you very much for your detailed response, I appreciate it.
I'm still struggling with the on-hover part: whole line is highlighted but data in the tool-tip doesn't change based on horizontal position of the cursor. As you can see, cursor is at the beginning but the data is from 30th October. What am I missing?
Code: https://gist.github.com/milochadam/8387aec61a687d69b5db4b0f586a3ace
Is it also possible to change position of the tool-tip if it would go outside of the chart area?
from graphic.
It does what I want, thank you very much : )
from graphic.
Related Issues (20)
- Take a look at my design!
- 对数坐标
- [BUG] Pinch zoom gesture causes an exception
- Error in TooltipRenderOp.render when a NaN value is selected
- Candlechart does not render circuit data points as it has same ohlc for that particular candle.
- Is it possible to Scroll only the barchart data and x axis without scrolling the y axis
- Add button to tooltip
- Mark transition and selections doesn't work well together.
- 如何实现Line Chart的实时变化 HOT 2
- Question: How to create this chart
- horizontalRangeUpdater 如何实现滚动到第一个坐标就截止,最后一个坐标也截止 HOT 1
- Is is possible to put a label to a graph axis? HOT 2
- Communicating with other widgets HOT 1
- Tool tip not working on iOS HOT 2
- 如何滑动到指定坐标点?
- 如何获取可视区域内的所有坐标点? HOT 1
- 如何给 X 轴的首尾添加箭头?
- Questions whether few things are possible
- marginMin、marginMax 设置为 0,会导致第一个和最后一个 Mark 的宽度只有一半
- Y轴的数值很长,会超出 Chart 显示区域范围
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 graphic.