PNChart属性标注

- (void)coifigChartStyle:(PNLineChart *)lineChart withXArray:(NSArray *)xArray  yArray:(NSArray *)yArray{

    //设置坐标轴是否可见
//    lineChart.showCoordinateAxis = YES;
    [lineChart setXLabels:xArray];
    //设置是否显示网格线
    lineChart.showYGridLines = YES;
    lineChart.showGenYLabels = YES;
    //设置坐标轴宽度
    lineChart.axisWidth = 2;
    //是否曲线x显示
    // _lineChart.showSmoothLines = YES;
    //x轴y轴颜色
    lineChart.axisColor = RGB(216, 216, 216);
    //lineChart.axisWidth = 1;
    //x轴字体颜色
    lineChart.xLabelColor = RGB(216, 216, 216);
    //y轴字体颜色
//    lineChart.yLabelColor = RGB(216, 216, 216);
    //是否显示x轴y轴
    lineChart.showCoordinateAxis = NO;
    //y轴分多少份
    lineChart.yLabelNum = 7;
    //显示标注
    lineChart.showLabel = YES;
    //y轴最大值
    lineChart.yFixedValueMax = 130;
    //y轴最小值
    lineChart.yFixedValueMin = 0;
    //y轴字体颜色
    lineChart.yLabelColor = [UIColor clearColor];
    //chartCavanWidth chartCavanHeight 可视范围
//    lineChart.chartCavanHeight = 300;

    
    PNLineChartData *data01 = [PNLineChartData new];
    //显示点标注
    data01.showPointLabel = YES;
    //点标注字体
    data01.pointLabelFont = SYSFONT_(9);
    //点标注颜色
    data01.color = [UIColor orangeColor];
    //点标注个数
    data01.itemCount = lineChart.xLabels.count;
    //点标注样式,圆角 三角
    data01.inflexionPointStyle = PNLineChartPointStyleCircle;
    
    data01.getData = ^(NSUInteger index){
        
        CGFloat yValue = [yArray[index] floatValue];
        
        return [ PNLineChartDataItem dataItemWithY:yValue];
        
    };
    
    lineChart.chartData = @[data01];
    //开始绘图
    [lineChart strokeChart];
}

你可能感兴趣的:(PNChart属性标注)