-
-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grid background #645
Comments
I would say yes, but it requires you to do some custom rendering. e.g. everytime get the four bouding points and fill it. The code can help calculate the point coordinates, but you have to render it. @danielgindi would you think it's a feature that will be used by many people? |
@liuxuan30 How would you recommend getting the four bounding points and filling it? (What part of the API?) Like the above request, I would like to shade a section of the background (e.g., in a line chart that shows the years 1990-2015 in x-axis, I want to be able to background shade 1998-2002 and then 2011-13). |
combine yMax, yMin, XMin, XMax, plus each data value, you will know the bounding points in data value coordinate space, and you can easily convert it to pixel coordinate space using chart transformer. ContentRect may also help, but it is in pixel space. |
@liuxuan30 Are there any good examples you point out of using |
Almost every renderer will use chart transformer (aka A good example is x axis render's |
@woutergoossens Not sure if you implemented anything yet, but based on guidance of @liuxuan30, I came up with the following solution for
I then added the following line to the
In my case, I need arbitrary grid areas that is based on the data. However, this could be modified to render a background for every other grid column. |
@richwagner good job! |
We may add this as a feature - I'm looking into it! Seems like something that could add style (or clarity!) to some charts. It's nice that we already have some code/logic here :-) I have just pushed a feature for filling line/radar charts with gradients or images, and I'm asking myself if we should be using the new @PhilJay, @richwagner what do you think? |
Yes, could definitely be a great new feature I would say. We need to think this though and come up with a solution that is as easy as possible to "use". |
Any propositions? |
Well I guess we definitely need an extra object that stores the information. |
@danielgindi I definitely would recommend adding this feature. Concerning an extra object: In my
I then add an area to a chart like:
|
That would be an overkill as you want alternation, not to specify each and every stripe of color, am I missing something? |
@danielgindi In my case, I needed to define arbitrary data-dependent grid areas, so that level of detail was helpful. But in the above case by @woutergoossens of alternate grid areas, that would be overkill. |
Is there any way to add custom drawing to the chart? eg. I would like similar functionality to this - but a little different, I want different background color for weekends, ie. very custom functionality. It would be great to add this as a class conforming to some Drawable interface. |
Was this ever implemented? Drawing a fill in between values, limit lines, etc... |
Here is my implementation if someone wishes to add to the library or do their own. Currently it fills in between 2 fill lines on the Y showing an area that would indicate an ideal range. Added this code to YAxisRenderer
then called it in BarLineChartViewBase
|
@jtweeks Would you be kind enough to tell me how do you call the function for the graph view ? |
what is the variable context: CGContext a reference to? |
@richwagner I'm working of your implementation but tried modified it so that we just provide an [Int]
EDIT: I ended up rewriting this to make it part of the BarChartRenderer rather than the axis, and allowing highlighting to be either https://github.com/AudaxHealthInc/Charts/tree/feature/missions |
Hi @danielgindi It's a perfect and great library. Has the Chart library given this feature now? |
Added this code to YAxisRenderer
called it in BarLineChartViewBase -> func draw(_ rect: CGRect) add an area to a chart like: Thanks @jtweeks |
@danielgindi is this feature available as part of latest library version ? |
Hi,
Great library!
I have to create a custom chart like this. Everything is working except for the different grid background colours. Is that possible with this library?
Thanks in advance,
Wouter
The text was updated successfully, but these errors were encountered: