/** * The graphical representation of the labels on the X axis. * * @param xLabels the X labels values * @param xTextLabelLocations the X text label locations * @param canvas the canvas to paint to * @param paint the paint to be used for drawing * @param left the left value of the labels area * @param top the top value of the labels area * @param bottom the bottom value of the labels area * @param xPixelsPerUnit the amount of pixels per one unit in the chart labels * @param minX the minimum value on the X axis in the chart */ protected void drawXLabels( List<Double> xLabels, Double[] xTextLabelLocations, Canvas canvas, Paint paint, int left, int top, int bottom, double xPixelsPerUnit, double minX, float hash_mark_height, float max_text_height) { int length = xLabels.size(); boolean showLabels = mRenderer.isShowLabels(); for (int i = 0; i < length; i++) { double label = xLabels.get(i); float xLabel = (float) (left + xPixelsPerUnit * (label - minX)); if (showLabels) { paint.setColor(mRenderer.getLabelsColor()); canvas.drawLine( xLabel, bottom, xLabel, bottom + hash_mark_height, paint); // FIXME Magic numbers drawText( canvas, getLabel(label, Axis.X_AXIS), xLabel, bottom + hash_mark_height + max_text_height, paint, 0); } if (mRenderer.isShowGrid() && mRenderer.isShowGridVerticalLines()) { paint.setColor(GRID_COLOR); canvas.drawLine(xLabel, bottom, xLabel, top, paint); } } if (showLabels) { paint.setColor(mRenderer.getLabelsColor()); for (Double location : xTextLabelLocations) { float xLabel = (float) (left + xPixelsPerUnit * (location.doubleValue() - minX)); canvas.drawLine(xLabel, bottom, xLabel, bottom + 4, paint); // FIXME Magic numbers drawText(canvas, mRenderer.getXTextLabel(location), xLabel, bottom + 12, paint, 0); } } }