Skip to content
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

Background color and floats on Y axis. #495

Closed
tomkowz opened this issue Oct 22, 2015 · 5 comments
Closed

Background color and floats on Y axis. #495

tomkowz opened this issue Oct 22, 2015 · 5 comments

Comments

@tomkowz
Copy link

tomkowz commented Oct 22, 2015

Hey, I'm trying to understand the library (iOS). I try to draw simple chart for forecast and have few problems:

  • I cannot change background color. Don't really know which value I should modify. The background is still white. View in storyboard has transparent background.
  • Values on Y axis are floating numbers instead of ints.
  • How to disable showing X and Y axis when selecting some value on a chart?

Thank you in advance

@liuxuan30
Copy link
Member

  1. use UIView.backgroundColor
  2. use yAxis.valueFormatter (+ forceLabelsEnabled + labelCount if you need to avoid duplicated int because 2.1 and 2.3 will be 2) read computeAxisValues carefully
  3. use drawLabelsEnabled properly when you highlight or have your own customization

If you are trying to understand, read each class's properties first.

@danielgindi
Copy link
Collaborator

@tomkowz set UIView.opaque to false if you want the chart to have a UIColor.clearColor as its backgroundColor. Otherwise the transparent background will be drawn as a black color.

@tomkowz
Copy link
Author

tomkowz commented Oct 23, 2015

Setting opaque to false and backgroundColor to clearColor was the first thing I did. And background is still white.

[_chartView setViewPortOffsetsWithLeft:0 top:0 right:0 bottom:0]; // LineChartView
_chartView.descriptionText = @"";
_chartView.noDataTextDescription = @"You need to provide data for the chart.";
_chartView.xAxis.enabled = NO;
_chartView.rightAxis.enabled = NO;
_chartView.legend.enabled = NO;
_chartView.opaque = NO;
_chartView.backgroundColor = [UIColor clearColor];

@pmairoldi
Copy link
Collaborator

Are you sure you are not talking about the gridBackgroundColor? I'm pretty sure that it isn't white by default but maybe try that.

@tomkowz
Copy link
Author

tomkowz commented Oct 23, 2015

You're right. gridBackgroundColor is what I need to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants