/** * 绘制最外围的标签及主轴的刻度线标签 * * @param canvas 画布 */ private void renderAxisLabels(Canvas canvas) { // 标签个数决定角的个数 int labelsCount = getPlotAgentNumber(); // 轴线tick总数 int dataAxisTickCount = getAxisTickCount(); for (int i = 0; i < dataAxisTickCount; i++) { for (int j = 0; j < labelsCount; j++) { // 绘制最外围的标签 if (i == dataAxisTickCount - 1) { // 绘制最外围的标签 String label = CategoryAxis.getDataSet().get(j); canvas.drawText(label, mArrayLabelX[i][j], mArrayLabelY[i][j], getLabelPaint()); } // 绘制主轴的刻度线与标签 if (0 == j) { // 显示在第一轴线上(即270度的那根线) // 绘制主轴(DataAxis)的刻度线 double tick = this.dataAxis.getAxisSteps() * i + dataAxis.getAxisMin(); dataAxis.renderAxisHorizontalTick( this, canvas, mArrayDotX[i][j], mArrayDotY[i][j], Double.toString(tick)); } } // end for labels } // end for data }
/** * 标签个数决定了图中角的个数 * * @return 标签总个数 */ private int getPlotAgentNumber() { return CategoryAxis.getDataSet().size(); }
/** * 分类轴的数据源 * * @param dataSeries 标签集 */ public void setCategories(List<String> dataSeries) { CategoryAxis.setDataBuilding(dataSeries); }