protected void onDraw(Canvas canvas) {

    super.onDraw(canvas);
    canvas.getClipBounds(mRect);

    final CategoryDataset dataset = createDataset();
    final JFreeChart chart = createChart(dataset);
    chart.draw(canvas, new Rectangle2D.Double(0, 0, mRect.width(), mRect.height()));
    Paint p = new Paint();
    p.setColor(Color.RED);
  }
  /**
   * Creates a sample chart.
   *
   * @param dataset the dataset.
   * @return a chart.
   */
  private JFreeChart createChart(final CategoryDataset dataset) {

    final JFreeChart chart =
        ChartFactory.createLineChart(
            "Line Chart Demo 5", // chart title
            "Type", // domain axis label
            "Value", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips
            false // urls
            );

    Paint white = new Paint(Paint.ANTI_ALIAS_FLAG);
    white.setColor(Color.WHITE);
    Paint dkGray = new Paint(Paint.ANTI_ALIAS_FLAG);
    dkGray.setColor(Color.DKGRAY);
    Paint lightGray = new Paint(Paint.ANTI_ALIAS_FLAG);
    lightGray.setColor(Color.LTGRAY);
    lightGray.setStrokeWidth(10);

    final CategoryPlot plot = chart.getCategoryPlot();

    plot.setBackgroundPaint(dkGray);
    plot.setDomainGridlinePaint(lightGray);
    plot.setRangeGridlinePaint(lightGray);
    plot.setDomainGridlinesVisible(true);

    chart.setBackgroundPaint(white);

    // set the stroke for each series...

    Paint blue = new Paint(Paint.ANTI_ALIAS_FLAG);
    blue.setColor(Color.rgb(125, 138, 46));
    // blue.set
    blue.setAlpha(200);
    blue.setStrokeWidth(10);
    Paint green = new Paint(Paint.ANTI_ALIAS_FLAG);
    green.setColor(Color.rgb(255, 240, 165));
    green.setAlpha(200);

    Paint red = new Paint(Paint.ANTI_ALIAS_FLAG);
    red.setColor(Color.rgb(182, 73, 38));
    red.setAlpha(200);

    plot.getRenderer().setSeriesPaint(0, blue);
    plot.getRenderer().setSeriesPaint(1, green);
    plot.getRenderer().setSeriesPaint(2, red);

    // customise the renderer...
    final LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
    renderer.setItemLabelsVisible(true);
    renderer.setSeriesShapesVisible(0, true);
    renderer.setSeriesShapesVisible(1, true);
    renderer.setSeriesShapesVisible(2, true);

    // customise the range axis...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setAutoRangeIncludesZero(false);
    rangeAxis.setUpperMargin(0.12);
    rangeAxis.setLabelAngle(90);

    final CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.STANDARD);
    return chart;
  }