-
-
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
Scroll UIImageView on X-axes along with x-vals #1775
Comments
that's because you add them with static coordinates and never update them. You should check how the renderer works. Basically, every time you scroll, you should update. However I don't think using a view is a good option. |
Can you tell me any other approach or is there any class that can be subclass to achieve this? |
I would say use CoreGraphics to do this, just like how this library do. You can take a look at x axis render how it draws the label |
I just added code to draw image in drawLabel method of ChartXAxisRenderer and it worked. Thanks Xuan |
@walinaqvi : Can you share your code with modification ? Thank you |
In ChartXAxisRenderer.swift i modified the signature of
and in ChartXAxisRendererBarChart.swift i passes appropriate image while calling method |
I just tried to add UIImageView on x-axes along with x-vals ,i get x coordinate of image from getPosition method of BarChartView and i'm hardcoding y coordinate something like this :
CGPoint imagePos = [_chartView getPosition:[yVals objectAtIndex:i] axis:AxisDependencyRight]; UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(imagePos.x, 30, 10, 10)];
and then i'm adding these images on BarChartView:
[_chartView addSubview:imageView];
its working fine when im not zooming or scrolling the Chart,the moment i'm scrolling the chart these images are fixed on same place and not scrolling along with X-Axes labels .
Is there any public property like UIScrollView,Where should i add these images ,So these images also scroll along with Bars of graph.
The text was updated successfully, but these errors were encountered: