0
votes

want line to be dashed

I would like this line to be dashed:

    RadarChartDataSet *benchMarkSet = [[RadarChartDataSet alloc] initWithYVals:benchMark label:@"Set 2"];
    [benchMarkSet setColor:[UIColor colorWithRed:125/255.0f green:125/255.0f blue:125/255.0f alpha:0.6f]];
    benchMarkSet.fillAlpha = 0.5f;
    benchMarkSet.lineWidth = 2.0;
    benchMarkSet.highlightLineWidth = 0.5;
    benchMarkSet.highlightLineDashPhase = 0;
    benchMarkSet.highlightLineDashLengths = @[@10, @5, @6, @5, @10, @0.0];
    benchMarkSet.highlightColor = [UIColor whiteColor];
    RadarChartData *data = [[RadarChartData alloc] initWithXVals:xVals dataSets:@[set2, benchMarkSet]];
    [data setValueFont:[UIFont fontWithName:@"HelveticaNeue-Light" size:8.f]];
    [data setDrawValues:NO];

    self.radarChart.data = data;

I've tried to play around with the methods: highlightLineWidth, highlightColor, highlightDashPhase, highlightDashLenghts to no avail - if someone has done this before that would be great! Currently those methods seem to do nothing.

1

1 Answers

0
votes

You are changing the wrong properties, this doesn't have anything to do with "highlighting". The bad news is that ios-charts don't have native support for what you want.

If you look into RadarChartRenderer, the renderer reads only color and lineWidth from data.

I would recommend you to create a subclass of RadarChartRenderer, override drawData:(context:), copying the original implementation but adding CGContextSetLineDash(...) before drawDataSet(...) call.

That just set instantiate your custom renderer and assign it to your chart view.