Comments (5)
I forgot to mention that using circleViewGenerator instead of the closure in bubblesLayer doesn't work. Perhaps my question can be rephrased as how to modify that closure to incorporate circleViewGenerator.
from swiftcharts.
The easiest way is to implement touchesEnded in the local BubbleView class, and pass a handler to it, similar to how it is implemented in ChartPointTextCircleView (which is used in the areas example) or HandlingView. Then you can do handling like in circleViewGenerator. To use the same info views you will have to rename the local class.
I'll add a generic bubble view in an upcoming version (with touch handler), which will replace the current BubbleView and ChartPointTextCircleView, and remove this local class.
The circleViewGenerator from areas principally works in the bubbles example, but you probably have a name clash with the local BubbleView class, plus the generated views work with cornerRadius, which you would have to adjust depending on the bubble's size.
from swiftcharts.
I implemented touchesEnded like you suggested.
Am I correct that bubbleViewGenerator, the analog to circleViewGenerator, will call MyBubbleView, my rename of the local BubbleView class? How do I pass this to the BubbleLayer?
Perhaps a gist (https://gist.github.com/mac389/0e2fbe441b1eef8538ae) will be more explanatory. Aside from the obvious modifications to MyBubbleView constructor. I think this file illustrates my confusion.
Thanks for your help in this.
I hope I get to the point where I can contribute to this project. I think increasing the ability of iOS to make scientific graphs is a worthy endeavour.
from swiftcharts.
Thanks!
I created this gist that does what you want: https://gist.github.com/i-schuetz/badf5ac8d8de3bb748f2
You will have to tinker a bit with the info bubbles, right now they are not designed to be used in this type of chart - for example the touch area of the bubble covers the rect including transparent area in the bottom where the arrow is, so if you try to tap a chartpoint in this area it will be absorbed by the info bubble. You may want to try to use a library specialised in info bubbles, for example https://github.com/chrismiles/CMPopTipView. My info bubbles are rather demonstrative purpose... I would have used CMPopTipView but didn't want to introduce external dependencies to the project. I maybe move this to the example project in the future.
Also, the reason that I didn't add touch handling to the bubble example, in the first place, was that the chartpoints can overlay each other (as seen in the example) and it's difficult for the user to tap a specific one. You can of course add special handling for this, like showing an intermediate selection view, etc.
Maybe your chart will not have overlapping chartpoints, in which case it's ok to add the touch handler like it is now.
from swiftcharts.
Thanks 👍
from swiftcharts.
Related Issues (20)
- Static library
- Temporarily hide lines in Line chart
- What's the correct way to set contentView background color and border? HOT 1
- Is this kind of y axis layout possible:
- Extending Views to create custom views isn't working due to file private and internal properties
- How to overlay a layer of labels?
- Axis disappear after coming back from background
- X Y points in horizontal bar chart keeps moving rights; when the y axis labels length (text) is more
- Swift 5
- Changing axis values
- X values not adding properly
- Axis Labels not showing up HOT 2
- ChartLabelSettings() ignoring supplied font color, always defaults to black HOT 1
- SPM Support?
- Problem building on new MacBook
- SPM not working properly due to missing TAG HOT 1
- x, y Axis didn't show in the Chart HOT 2
- ChartPointsBubbleLayer not draws properly HOT 1
- how to dynamic live update line chart
- How can i make xAxisLabel to get multiple data instead of one value for one xAxisLabel ?
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 swiftcharts.