/* Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package uk.ac.cam.cl.dtg.snowdon; import android.content.Context; import android.graphics.Canvas; import android.util.AttributeSet; /** * Inherits from GraphView and draws a graph with a simple line * between data points. Ascending and descending lines may have different * colours, if specified by XML, or by setAscendingColor() or setDescendingColor(). */ public class LineGraphView extends GraphView { /** * Creates a new LineGraphView and sets layout parameters from XML via * GraphView. * * @param context * @param attributes */ public LineGraphView(Context context, AttributeSet attributes) { super(context, attributes); } @Override protected void drawAscendingSection(Canvas canvas, float[] coords) { canvas.drawLine(coords[0], coords[1], coords[2], coords[3], mAscendingPaint); } @Override protected void drawDescendingSection(Canvas canvas, float[] coords) { canvas.drawLine(coords[0], coords[1], coords[2], coords[3], mDescendingPaint); } }