Giter Club home page Giter Club logo

Comments (5)

mac389 avatar mac389 commented on May 28, 2024

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.

ivnsch avatar ivnsch commented on May 28, 2024

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.

mac389 avatar mac389 commented on May 28, 2024

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.

ivnsch avatar ivnsch commented on May 28, 2024

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.

mac389 avatar mac389 commented on May 28, 2024

Thanks 👍

from swiftcharts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.