我有一个样式类似的图表,但是该图表无法填充视图,它似乎在边缘之间保持了一定的间距,好像允许绘制轴标签。如何强制图表部分采用“图表”视图的完整大小?
检查视图时,需要使用LineChartViews大小,只是在图形和视图之间有明显的间距,它的插图,我似乎想不出来防止这种情况。
self.chartView = [[LineChartView alloc] init];
self.chartView.delegate = self;
self.chartView.chartDescription.enabled = NO;
self.chartView.chartDescription.enabled = NO;
self.chartView.dragEnabled = NO;
self.chartView.pinchZoomEnabled = NO;
self.chartView.drawGridBackgroundEnabled = NO;
[self.chartView setScaleEnabled:NO];
[self.chartView setUserInteractionEnabled:NO];
ChartYAxis *leftAxis = self.chartView.leftAxis;
leftAxis.axisMaximum = minVal.doubleValue;
leftAxis.axisMinimum = maxVal.doubleValue;
leftAxis.drawGridLinesEnabled = NO;
leftAxis.drawZeroLineEnabled = NO;
leftAxis.drawLimitLinesBehindDataEnabled = NO;
leftAxis.drawAxisLineEnabled = NO;
leftAxis.drawLabelsEnabled = NO;
self.chartView.xAxis.drawAxisLineEnabled = NO;
self.chartView.xAxis.drawGridLinesEnabled = NO;
self.chartView.xAxis.drawLabelsEnabled = NO;
self.chartView.rightAxis.enabled = NO;
self.chartView.legend.form = ChartLegendFormLine;
self.chartView.legend.enabled = NO;
我已经通过反复试验弄清楚了。
self.chartView.minOffset = 0;