Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
55
Customizing the Axis
posted

Hi,

I have a couple of issues:

1. I was looking into customizing the axis strokes but setting the colors doesn't seem to work. 

    IGCategoryAxisBase* axis = [[[IGCategoryXAxis class] allocinitWithKey:key];

    [axis setOverlap:self.model.graph.overlap];

    [axis setGap:self.model.graph.gap];

    [axis setMajorStrokeThickness:7.0f];

    [axis setMinorStrokeThickness:3.0f];

    [axis setStrokeThickness:5.0f];

    [axis setLabelsVisible:YES];

    [axis setMinorStroke:[[IGBrush alloc] initWithColor:[UIColor redColor]]];

    [axis setStroke:[[IGBrush alloc] initWithColor:[UIColor purpleColor]]];

    [axis setMajorStroke:[[IGBrush alloc] initWithColor:[UIColor blueColor]]];

    [axis setTickLength:0.0f];

2. In Android, there is a way to not display the first label in the axis using: axis.setShowFirstLabel(false);, but the method doesn't seem to be available in iOS. Is there a way that this can be achieved in iOS?

3. In Android, there is a way to customize the axis label using: axis.setLabelTextSize(16);, but the method doesn't seem to be available in iOS. Is there a way that this can be achieved in iOS?

Parents
  • 26458
    Verified Answer
    Offline posted

    I wasn't able to reproduce the problem with the stroke brushes. It might be a bug in the trial version, but to be sure please run the attached sample and let me know if you're unable to see the axis stroke and major stroke brushes.

    There's no property to hide the first label, but you can work around it by handling one of the chart's delegate methods -chartView:labelForAxis:
    I've included that in the sample.

    Text size can only be customized by using a custom theme, which would apply the same font to all the chart's axes. Setting a font on individual axes is not currently supported in iOS, although, we do have a new smart axis panel feature that does allow you to set font and font size for category axes. That could be an option for you to try. 

    ChartAxisColorsTest.zip
Reply Children