Search in sources :

Example 6 with LineSet

use of com.db.chart.model.LineSet in project WilliamChart by diogobernardino.

the class LineCardThree method show.

@Override
public void show(Runnable action) {
    super.show(action);
    LineSet dataset = new LineSet(mLabels, mValues[0]);
    dataset.setColor(Color.parseColor("#53c1bd")).setFill(Color.parseColor("#3d6c73")).setGradientFill(new int[] { Color.parseColor("#364d5a"), Color.parseColor("#3f7178") }, null);
    mChart.addData(dataset);
    mChart.show(new Animation().withEndAction(action));
}
Also used : Animation(com.db.chart.animation.Animation) LineSet(com.db.chart.model.LineSet)

Example 7 with LineSet

use of com.db.chart.model.LineSet in project WilliamChart by diogobernardino.

the class LineCardTwo method show.

@Override
public void show(Runnable action) {
    super.show(action);
    LineSet dataset = new LineSet(mLabels, mValues[0]);
    dataset.setColor(Color.parseColor("#004f7f")).setThickness(Tools.fromDpToPx(3)).setSmooth(true).beginAt(4).endAt(36);
    for (int i = 0; i < mLabels.length; i += 5) {
        Point point = (Point) dataset.getEntry(i);
        point.setColor(Color.parseColor("#ffffff"));
        point.setStrokeColor(Color.parseColor("#0290c3"));
        if (i == 30 || i == 10)
            point.setRadius(Tools.fromDpToPx(6));
    }
    mChart.addData(dataset);
    Paint thresPaint = new Paint();
    thresPaint.setColor(Color.parseColor("#0079ae"));
    thresPaint.setStyle(Paint.Style.STROKE);
    thresPaint.setAntiAlias(true);
    thresPaint.setStrokeWidth(Tools.fromDpToPx(.75f));
    thresPaint.setPathEffect(new DashPathEffect(new float[] { 10, 10 }, 0));
    Paint gridPaint = new Paint();
    gridPaint.setColor(Color.parseColor("#ffffff"));
    gridPaint.setStyle(Paint.Style.STROKE);
    gridPaint.setAntiAlias(true);
    gridPaint.setStrokeWidth(Tools.fromDpToPx(.75f));
    mChart.setXLabels(AxisRenderer.LabelPosition.OUTSIDE).setYLabels(AxisRenderer.LabelPosition.NONE).setGrid(0, 7, gridPaint).setValueThreshold(80f, 80f, thresPaint).setAxisBorderValues(0, 110).show(new Animation().fromXY(0, .5f).withEndAction(action));
}
Also used : Animation(com.db.chart.animation.Animation) DashPathEffect(android.graphics.DashPathEffect) Point(com.db.chart.model.Point) Paint(android.graphics.Paint) LineSet(com.db.chart.model.LineSet) Point(com.db.chart.model.Point) Paint(android.graphics.Paint)

Example 8 with LineSet

use of com.db.chart.model.LineSet in project WilliamChart by diogobernardino.

the class LineFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View layout = inflater.inflate(R.layout.fragment_line, container, false);
    mChart = (LineChartView) layout.findViewById(R.id.chart);
    mFirstStage = true;
    layout.setOnClickListener(this);
    mChart.setOnClickListener(this);
    LineSet dataset = new LineSet(mLabels, mValues[0]);
    dataset.setColor(Color.parseColor("#004f7f")).setThickness(Tools.fromDpToPx(3)).setSmooth(true).beginAt(4).endAt(36);
    for (int i = 0; i < mLabels.length; i += 5) {
        Point point = (Point) dataset.getEntry(i);
        point.setColor(Color.parseColor("#ffffff"));
        point.setStrokeColor(Color.parseColor("#0290c3"));
        if (i == 30 || i == 10)
            point.setRadius(Tools.fromDpToPx(6));
    }
    mChart.addData(dataset);
    Paint thresPaint = new Paint();
    thresPaint.setColor(Color.parseColor("#0079ae"));
    thresPaint.setStyle(Paint.Style.STROKE);
    thresPaint.setAntiAlias(true);
    thresPaint.setStrokeWidth(Tools.fromDpToPx(.75f));
    thresPaint.setPathEffect(new DashPathEffect(new float[] { 10, 10 }, 0));
    Paint gridPaint = new Paint();
    gridPaint.setColor(Color.parseColor("#ffffff"));
    gridPaint.setStyle(Paint.Style.STROKE);
    gridPaint.setAntiAlias(true);
    gridPaint.setStrokeWidth(Tools.fromDpToPx(.75f));
    mChart.setBorderSpacing((int) Tools.fromDpToPx(0)).setXLabels(AxisRenderer.LabelPosition.OUTSIDE).setLabelsColor(Color.parseColor("#304a00")).setYLabels(AxisRenderer.LabelPosition.NONE).setXAxis(false).setYAxis(false).setGrid(1, 7, gridPaint).setValueThreshold(80f, 80f, thresPaint).setAxisBorderValues(0, 110);
    mChart.show(new Animation().fromXY(0, .5f));
    return layout;
}
Also used : Animation(com.db.chart.animation.Animation) DashPathEffect(android.graphics.DashPathEffect) Point(com.db.chart.model.Point) Paint(android.graphics.Paint) ChartView(com.db.chart.view.ChartView) View(android.view.View) LineChartView(com.db.chart.view.LineChartView) LineSet(com.db.chart.model.LineSet) Point(com.db.chart.model.Point) Paint(android.graphics.Paint)

Aggregations

LineSet (com.db.chart.model.LineSet)8 Animation (com.db.chart.animation.Animation)4 DashPathEffect (android.graphics.DashPathEffect)3 Paint (android.graphics.Paint)3 View (android.view.View)2 TextView (android.widget.TextView)2 Point (com.db.chart.model.Point)2 ChartView (com.db.chart.view.ChartView)2 LineChartView (com.db.chart.view.LineChartView)2 Path (android.graphics.Path)1 PorterDuffColorFilter (android.graphics.PorterDuffColorFilter)1 ViewGroup (android.view.ViewGroup)1 BounceInterpolator (android.view.animation.BounceInterpolator)1 AdapterView (android.widget.AdapterView)1 Button (android.widget.Button)1 CompoundButton (android.widget.CompoundButton)1 ImageView (android.widget.ImageView)1 LinearLayout (android.widget.LinearLayout)1 SeekBar (android.widget.SeekBar)1 ChartSet (com.db.chart.model.ChartSet)1