PerformanceChart 0.1.0

PerformanceChart 0.1.0

JunyiXie 维护。



  • 作者
  • junyixie

PerformanceChart

CI Status Version License Platform

使用

- (XLineChartPoint *)lineChart:(XLineChart *)lineChart pointForLineAtIndexPath:(NSIndexPath *)indexPath {
  XLineChartPoint *point = [[XLineChartPoint alloc] init];

  if (indexPath.section == ChartMonitorKindCPU) {
    point.fillColor = cpu_color.CGColor;
    point.diameter = 4;
    point.pointType = XPointAnnular;
  } else if (indexPath.section == ChartMonitorKindMEMORY) {
    point.fillColor = memory_color.CGColor;
    point.diameter = 4;
    point.pointType = XPointAnnular;
  } else {
    point.fillColor = fps_color.CGColor;
    point.diameter = 4;
    point.pointType = XPointAnnular;
  }

  return point;

}

- (CGFloat)lineChart:(XLineChart *)lineChart valueOfPointAtIndexPath:(NSIndexPath *)indexPath {
    
    // 注意 不能超过图表创建的 top 和 bottom
    return 0.5;
    
}


- (NSInteger)lineChart:(XLineChart *)lineChart numberOfPointsInLine:(NSInteger)section {
  
  // 根据你的数据源数量
  // return array.counts;
}

- (XLineChartGradientLine *)lineChart:(XLineChart *)lineChart lineForLineChartAtIndex:(NSInteger)index {
  XLineChartGradientLine *line = [[XLineChartGradientLine alloc] init];

  if (index == ChartMonitorKindCPU) {

    line.colors = @[
                    (__bridge id)cpu_color.CGColor,
                    (__bridge id)[UIColor whiteColor].CGColor
                    ];
    line.opacity = 0.6;
    line.lineMode = XStraightLine;
    line.lineWidth = 1.5;

  } else if(index == ChartMonitorKindMEMORY) {
    line.lineWidth = 1.5;
    line.lineMode = XStraightLine;
    line.colors = @[
                    (__bridge id)memory_color.CGColor,
                    (__bridge id)[UIColor whiteColor].CGColor
                    ];
    line.opacity = 0.6;
  } else {
    line.lineWidth = 1.5;
    line.lineMode = XStraightLine;
    line.colors = @[
                    (__bridge id)fps_color.CGColor,
                    (__bridge id)[UIColor whiteColor].CGColor
                    ];
    line.opacity = 0.6;
  }

  
  return line;


}

-(NSInteger)numberOfLinesInLineChart:(XLineChart *)lineChart {
// 根据你线的数量
  return 3;
}

- (NSString *)lineChart:(XLineChart *)lineChart titleForAbscissaAtIndex:(NSInteger)index {
  return time_str;
}

示例

要运行示例项目,请先克隆仓库,然后从 Example 目录运行 pod install

要求

安装

PerformanceChart 可通过 CocoaPods 获得使用。要安装它,请在 Podfile 中简单地添加以下行

pod 'PerformanceChart'

作者

junyixie, [email protected]

许可证

PerformanceChart可供MIT许可证使用。有关更多信息,请参阅LICENSE文件。