I am using iOS Charts (https://github.com/danielgindi/Charts) for line chart.
I gave background color to grid (Light Gray) as don’t want to include axis values.
lineChartView.gridBackgroundColor = .lightGray
Is there any way i can make corner of the graph rounded. not able to give corner radius for grid background color.
Related
On the JOSM interface I have the background colour as white. The scale bar top left shows distance using white text. This is invisible on a white background. Can the colour of the scale bar text be changed so that is is visible when the background is white? JOSM version 17013 Java 1.8.0_271.
I want to draw a border around the data area of my chart. Therefor I use chart.dataArea().background().stroke() but the stroke is partially hidden behind the background fill color of the data area.
See this playground example:
https://playground.anychart.com/LfsMXtpR
Of course I could just make it thicker, but I want it to be the same thickness all around.
I think the stroke shouldn't be hidden by the background fill.
Thanks ahead.
The reason is that yAxis has greater zIndex then data-area. You can decrease the yAxis zIndex to solve it, check the modified sample.
I'm trying to make a functionality which will show the color of like and dislike, just like we like / dislike a video on YouTube. So, green color will represent the likes and the black color will represent the dislikes, their percentage will change on the click of two buttons, i have no idea how to do it..something like this pic but without showing the percentage
Just do the simple maths first. Calculate likes/totalHits ratio and then use a image for progressbar with center area transparent where you can fill color. Put a label behing this image and just give it green color. Then adjust the width of green colored label using this ratio we calculated. :)
Create a ImageView in xib file and set the image of progress bar with transparent center area
Create a label of same size as imageView and put it behind this imageView Created with black color
Create one more label of green color and put it in between this black label and Imageview.
Now its time to code :)
in code calculate ratio = Likes/TotalHits
Now set the frame of green label as:
CGRectMake(x,y,ratio*totalWidthOfProgressBar,height)
where x and y should be the same as of progress Bar imageView and height should also be the same, you just need to set the frame again and again while user tap on likes or dislikes button.
and to display percentage value create a label over progress bar and display value = ratio*100 in that label
How can I get the color in a gradient at a specific position in iOS 5?
I have a vertical bar with a gradient from red to green and on the left side is a triangle showing the position in the bar. How can I fill the triangle with the color of the bar at that position?
I think in Mac OS X it's "interpolatedColorAtLocation" but how about iOS 5?
Thank you for help.
There's no API for this in iOS. You'll have to do the gradient interpolation yourself, or draw your gradient into a CGBitmapContext and then find the pixel value in the bitmap's raw data.
I'm designing a progress bar for an app that essentially is two UIImages - both are the exact same size (long rectangles with rounded corners), except they are colored differently.
The bottom bar is black and the progress bar that will fill over it is grey. Displaying the bottom bar is easy enough. The issue I'm trying to figure out is how to get the grey bar to display only a piece of itself.
For example....
grey : <-------
white: <------------------->
Essentially, I'd like to display only the first half of the grey bar because my progress is at 50%. I'd like to keep the rounded corners at the left of the image though.
Is it possible to dynamically crop UIImages?
The easiest way to do that is to create using 3 separated images: 2 with rounded corners (left and right), and one small easily resizable image to display progress.
And yes, you can crop images dynamically, but not as easy and as quick as need for progress bar.