Comments (9)
No, for this version it doesn't support. There's a planned responsive element support and a model layer for interactive support.
Will work on this 😸
from plotters.
Any progress on this?
from plotters.
Yep, this is the case. What I am planning at this point is following.
Plotters doesn't directly response any event, however, Plotters helps to dispatch events. But handling a event should be out of Plotters' scope.
Let's say, if there's an point element in the drawing area, once a click event is acknowledged by whatever UI infrastructure (e.g HTML canvas or GTK, etc), we should expose a function that accepts a event (type, pixel coordinate, etc... e.g. Hover(100,100)
), and returns the dispatched event like Hover on a particular element
.
It's pretty much like something happens here https://github.com/38/plotters/blob/98c78d84579edade6f55335748141d82d8177745/examples/wasm-demo/www/index.js#L47 (P.S. This is exactly my prototype of interactivity back to the very early days of Plotters)
So I think if you need a bubble tooltip, probably we can use two layers of canvas and one for the actual plot and another for the tool tips and the code might be like.
function onMouseHover(event) {
var dispatched_event = chart.dispatch_event(event));
if(dispatched_event != null && dispatched_event.element_type = "point") {
draw_tooltip(....);
}
}
And ideally, the interactivity shouldn't be related to the backend - Since it's application's responsibility to decide whatever they need to do, Plotters is only responsible for identify the event and dispatch it.
That's what I mean by saying add a model layer - A data structure that tracking interactive elements has been drawn to the chart. And once a event is feed into Plotters, it query the data structure and figure out which interactive element should response to this.
And we can provide some standard helper javascript, so that people can do zoom, tooltips, etc very easily. I believe this is the second step.
This idea is actually in my mind for almost one year, but it still only a rough plan. Please let me know if you feel anything isn't right.
Thanks so much!
from plotters.
How can I help with this?
Right now I'm using CanvasBackend
and I need to have some interactivity. I tried SVGBackend
but it doesn't' work with wasm. I was thinking about implementing custom svg backend for the seed wasm framework, but if you have better ideas please share!
from plotters.
Hi @TatriX, I am really appreciated if you could help on this. One note I need to add is I have a plan to make some breaking change on the API which makes me considering publishing a 0.3 version.
One thing in the purposed major release might be related to this is I am planning to have most of the backend moved to separate crates (very similar to what serde currently doing).
So this may have some change to the API and the architecture. I personally wish you base on the v0.3 branch, since I believe I am going to publish it maybe in a month or two. See the branch at https://github.com/38/plotters/tree/v0.3-pre
And all the backend code is under https://github.com/plotters-rs
I really appreciate your help. And you are also welcome to work on the master branch (But in this case I might be think how to make it work on the 0.3 branch as well). But it's up to you to base on the master or v0.3-pre.
Thanks again!
Cheers
from plotters.
Sure! Then I'll start by migrating my project to v0.3
to learn it first.
from plotters.
So, I've finally looked at the DrawingBackend
and plotters-canvas
and plotters-svg
.
Let's say I want to do a simple thing: show a box with some text when user hovers a cursor on a data point. I can't see how this can be supported with the current API. Do you have any ideas on how it should be approached?
from plotters.
What is the next step in getting interactivity working and what can be done to help?
from plotters.
Is there any update on the interactivity for plotters? If work has been done can I see what has been done so far and how I can help
from plotters.
Related Issues (20)
- Ability to save figures in the same way you can in rust in a notebook environment. HOT 3
- [BUG] currently nightly compiler cannot build plotters due to bug in pathfinder (simd) HOT 11
- [BUG] Even your own Examples doesn't work HOT 3
- [BUG] Drawing series can hang under certain conditions HOT 7
- [BUG] Can't outline/stroke polygon for svg HOT 1
- [BUG] example crash under centos 7.5 HOT 1
- [BUG] plotters-canvas build error
- plotters v0.3.5 has RUSTSEC-2023-0020 from font-kit v0.11.0 HOT 2
- [BUG] titled function draw text position error when generating PNG file HOT 3
- [BUG] unsafe preconditions violated HOT 12
- default font size?
- [BUG] Spacing between words removed HOT 1
- Step charts
- [BUG] 'static lifetime requirement for `ChartContext`
- pie RGBAcolor
- Warning due to use of deprecated default_features HOT 1
- [BUG] AsRangedCoord not implemented for Range<NaiveDateTime>
- Drawing 3d Voxels
- [BUG] Time for axes does not work on single day with different hours
- [Feature Request] Stroke width/outline for text in bitmap backend
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 plotters.