Charts icon indicating copy to clipboard operation
Charts copied to clipboard

How to get all the Marker points in line graph with multiple lines.

Open KunalDev opened this issue 5 years ago • 11 comments

I am implementing line chart with Multiple(Two) lines (Sales of current month and previous month on the day basis). On graph click we can pop up a view (BalloonMarker) which shows Graph Point. But there is a limitation. It shows only one line point. Is there way we can get points for both lines? And display round circles on selected points on both lines? I also need to customize BalloonMarker view.

I have attached current and expected layout image:

Current:-

Current

Expected:

Expected

KunalDev avatar Aug 09 '19 13:08 KunalDev

I don't think this is possible because you don't necessarily have the same X coordinate for both data sets. You're not using the same X range with two different Y values on the line graph.

However, something that would be nice is to identify in the marker which line graph the marker is referring to. I don't think this is currently possible. For example in my chart:

graph

The BalloonMarker points to the green plot, but the label is just "Value" because I don't know which one it's pointing to. The IMarker interface func is as follows:

override func refreshContent(entry: ChartDataEntry, highlight: Highlight)

The "entry" parameter has x and y values but doesn't provide a way to know which line is currently being pointed to.

kkieffer avatar Sep 11 '19 03:09 kkieffer

Spoke too soon. There's an additional "data" field that's an Any? in ChartDataEntry. When you create your data set you can set this to a string. Then in refreshContent() function:

let label = entry.data as! String

and label is the type of your Y value

kkieffer avatar Sep 11 '19 03:09 kkieffer

it's possible Capture

thierryH91200 avatar Sep 11 '19 08:09 thierryH91200

@kkieffer Thanks. It helps me.

I am able to display alert for both the points. Passing x value index as “data" field in Any? in ChartDataEntry. Alertt

I am using same x Range for both lines. I believe that currently graph is displaying line and give point to nearest y Value of any graph line. It would be great if it takes x value and display marker on both the graph point with that xValue.

Ex

Interaction

KunalDev avatar Sep 19 '19 12:09 KunalDev

How to show pop up arrow with custom XIB ?

PrashantKT avatar Oct 17 '19 11:10 PrashantKT

I am implementing line chart with Multiple(Two) lines (Sales of current month and previous month on the day basis). On graph click we can pop up a view (BalloonMarker) which shows Graph Point. But there is a limitation. It shows only one line point. Is there way we can get points for both lines? And display round circles on selected points on both lines? I also need to customize BalloonMarker view.

I have attached current and expected layout image:

Current:-

Current

Expected:

Expected

Have u figure out how to display round circles on selected points on both lines? Bitmap@2x

ninevcat avatar Sep 01 '20 09:09 ninevcat

Has the problem been solved? I have the same problem

pu943980293 avatar Jul 12 '21 05:07 pu943980293

same problem

banghuazhao avatar Nov 06 '21 02:11 banghuazhao

I am implementing line chart with Multiple(Two) lines (Sales of current month and previous month on the day basis). On graph click we can pop up a view (BalloonMarker) which shows Graph Point. But there is a limitation. It shows only one line point. Is there way we can get points for both lines? And display round circles on selected points on both lines? I also need to customize BalloonMarker view. I have attached current and expected layout image: Current:- Current Expected: Expected

Have u figure out how to display round circles on selected points on both lines? Bitmap@2x

Have you figured out how to outline circles?

davita00101110dmg avatar Jan 24 '24 14:01 davita00101110dmg

@kkieffer can you send me your custom marker code please?

SujalGondaliya1 avatar Jul 10 '24 06:07 SujalGondaliya1

Have a look at this thread

kkieffer avatar Jul 13 '24 01:07 kkieffer