Search in sources :

Example 26 with DashPathEffect

use of android.graphics.DashPathEffect in project UltimateAndroid by cymcsg.

the class HomeDiagram method drawStraightLine.

/**
	 * 绘制竖线
	 * 
	 * @param c
	 */
public void drawStraightLine(Canvas c) {
    paint_dottedline.setColor(fineLineColor);
    int count_line = 0;
    for (int i = 0; i < milliliter.size(); i++) {
        if (count_line == 0) {
            c.drawLine(interval_left_right * i, 0, interval_left_right * i, getHeight(), paint_date);
        }
        if (count_line == 2) {
            c.drawLine(interval_left_right * i, tb * 1.5f, interval_left_right * i, getHeight(), paint_date);
        }
        if (count_line == 1 || count_line == 3) {
            Path path = new Path();
            path.moveTo(interval_left_right * i, tb * 1.5f);
            path.lineTo(interval_left_right * i, getHeight());
            PathEffect effects = new DashPathEffect(new float[] { tb * 0.3f, tb * 0.3f, tb * 0.3f, tb * 0.3f }, tb * 0.1f);
            paint_dottedline.setPathEffect(effects);
            c.drawPath(path, paint_dottedline);
        }
        count_line++;
        if (count_line >= 4) {
            count_line = 0;
        }
    }
    c.drawLine(0, getHeight() - tb * 0.2f, getWidth(), getHeight() - tb * 0.2f, paint_brokenline_big);
}
Also used : Path(android.graphics.Path) DashPathEffect(android.graphics.DashPathEffect) PathEffect(android.graphics.PathEffect) DashPathEffect(android.graphics.DashPathEffect) Paint(android.graphics.Paint)

Example 27 with DashPathEffect

use of android.graphics.DashPathEffect in project UltimateRecyclerView by cymcsg.

the class MultiViewTypesActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_loadmore);
    toolbar = (Toolbar) findViewById(R.id.tool_bar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    ultimateRecyclerView = (UltimateRecyclerView) findViewById(R.id.ultimate_recycler_view);
    ultimateRecyclerView.setHasFixedSize(false);
    List<String> stringList = new ArrayList<>();
    stringList.add("111");
    stringList.add("aaa");
    stringList.add("222");
    stringList.add("33");
    stringList.add("44");
    stringList.add("55");
    simpleRecyclerViewAdapter = new MultiViewTypesRecyclerViewAdapter(stringList);
    simpleRecyclerViewAdapter.setCustomLoadMoreView(LayoutInflater.from(this).inflate(R.layout.custom_bottom_progressbar, null));
    //        stringList.add("66");
    //        stringList.add("11771");
    linearLayoutManager = new LinearLayoutManager(this);
    ultimateRecyclerView.setLayoutManager(linearLayoutManager);
    // ultimateRecyclerView.setAdapter(simpleRecyclerViewAdapter);
    ultimateRecyclerView.setAdapter(simpleRecyclerViewAdapter);
    ultimateRecyclerView.setDefaultOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            new Handler().postDelayed(new Runnable() {

                @Override
                public void run() {
                    simpleRecyclerViewAdapter.insert("Refresh things", 0);
                    ultimateRecyclerView.setRefreshing(false);
                    //   ultimateRecyclerView.scrollBy(0, -50);
                    linearLayoutManager.scrollToPosition(0);
                }
            }, 1000);
        }
    });
    Paint paint = new Paint();
    paint.setStrokeWidth(5);
    paint.setColor(Color.BLUE);
    paint.setAntiAlias(true);
    paint.setPathEffect(new DashPathEffect(new float[] { 25.0f, 25.0f }, 0));
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
        ultimateRecyclerView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }
    ultimateRecyclerView.addItemDecoration(new HorizontalDividerItemDecoration.Builder(this).paint(paint).build());
//  simpleRecyclerViewAdapter.ad
}
Also used : ArrayList(java.util.ArrayList) Handler(android.os.Handler) DashPathEffect(android.graphics.DashPathEffect) Paint(android.graphics.Paint) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) HorizontalDividerItemDecoration(com.marshalchen.ultimaterecyclerview.ui.divideritemdecoration.HorizontalDividerItemDecoration)

Example 28 with DashPathEffect

use of android.graphics.DashPathEffect in project WilliamChart by diogobernardino.

the class SandboxFragment method buildChart.

private static void buildChart(ChartView chart) {
    mGridPaint = new Paint();
    mGridPaint.setColor(mGridColorId);
    mGridPaint.setStyle(Paint.Style.STROKE);
    mGridPaint.setAntiAlias(true);
    mGridPaint.setStrokeWidth(Tools.fromDpToPx(mGridThickness));
    if (mIsGridDashed)
        mGridPaint.setPathEffect(new DashPathEffect(mGridDashType, 0));
    chart.setXAxis(mHasXAxis).setXLabels(mXLabelPosition).setYAxis(mHasYAxis).setYLabels(mYLabelPosition).setLabelsColor(mLabelColorId).setAxisColor(mAxisColorId);
    if (mGridType != null) {
        if (mGridType.compareTo(GridType.FULL) == 0)
            chart.setGrid(5, 5, mGridPaint);
        if (mGridType.compareTo(GridType.VERTICAL) == 0)
            chart.setGrid(0, 5, mGridPaint);
        if (mGridType.compareTo(GridType.HORIZONTAL) == 0)
            chart.setGrid(5, 0, mGridPaint);
    }
    chart.setLabelsFormat(new DecimalFormat("#" + mLabelFormat));
    chart.show(buildAnimation());
}
Also used : DecimalFormat(java.text.DecimalFormat) DashPathEffect(android.graphics.DashPathEffect) Paint(android.graphics.Paint)

Example 29 with DashPathEffect

use of android.graphics.DashPathEffect in project WilliamChart by diogobernardino.

the class StackedFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View layout = inflater.inflate(R.layout.fragment_stacked, container, false);
    mChart = (StackBarChartView) layout.findViewById(R.id.chart);
    mFirstStage = true;
    layout.setOnClickListener(this);
    mChart.setOnClickListener(this);
    Paint thresPaint = new Paint();
    thresPaint.setColor(Color.parseColor("#dad8d6"));
    thresPaint.setPathEffect(new DashPathEffect(new float[] { 10, 20 }, 0));
    thresPaint.setStyle(Paint.Style.STROKE);
    thresPaint.setAntiAlias(true);
    thresPaint.setStrokeWidth(Tools.fromDpToPx(.75f));
    BarSet stackBarSet = new BarSet(mLabels, mValuesOne[0]);
    stackBarSet.setColor(Color.parseColor("#a1d949"));
    mChart.addData(stackBarSet);
    stackBarSet = new BarSet(mLabels, mValuesOne[1]);
    stackBarSet.setColor(Color.parseColor("#ffcc6a"));
    mChart.addData(stackBarSet);
    stackBarSet = new BarSet(mLabels, mValuesOne[2]);
    stackBarSet.setColor(Color.parseColor("#ff7a57"));
    mChart.addData(stackBarSet);
    mChart.setBarSpacing(Tools.fromDpToPx(15));
    mChart.setRoundCorners(Tools.fromDpToPx(1));
    mChart.setXAxis(false).setXLabels(AxisRenderer.LabelPosition.OUTSIDE).setYAxis(false).setYLabels(AxisRenderer.LabelPosition.NONE).setValueThreshold(89.f, 89.f, thresPaint);
    mChart.show(new Animation().setOverlap(.5f, new int[] { 0, 1, 2, 3, 4, 5, 6 }));
    return layout;
}
Also used : BarSet(com.db.chart.model.BarSet) Animation(com.db.chart.animation.Animation) DashPathEffect(android.graphics.DashPathEffect) Paint(android.graphics.Paint) StackBarChartView(com.db.chart.view.StackBarChartView) View(android.view.View)

Example 30 with DashPathEffect

use of android.graphics.DashPathEffect 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.setBorderSpacing(Tools.fromDpToPx(0)).setXLabels(AxisRenderer.LabelPosition.OUTSIDE).setLabelsColor(Color.parseColor("#304a00")).setYLabels(AxisRenderer.LabelPosition.NONE).setXAxis(false).setYAxis(false).setGrid(0, 7, gridPaint).setValueThreshold(80f, 80f, thresPaint).setAxisBorderValues(0, 110);
    Animation anim = new Animation().setStartPoint(0, .5f).setEndAction(action);
    mChart.show(anim);
}
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)

Aggregations

DashPathEffect (android.graphics.DashPathEffect)45 Paint (android.graphics.Paint)34 Path (android.graphics.Path)7 PathEffect (android.graphics.PathEffect)7 Animation (com.db.chart.animation.Animation)4 LineSet (com.db.chart.model.LineSet)3 Cap (android.graphics.Paint.Cap)2 Join (android.graphics.Paint.Join)2 Style (android.graphics.Paint.Style)2 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)2 View (android.view.View)2 BarSet (com.db.chart.model.BarSet)2 Point (com.db.chart.model.Point)2 ArrayList (java.util.ArrayList)2 BasicStroke (org.achartengine.renderer.BasicStroke)2 SuppressLint (android.annotation.SuppressLint)1 TypedArray (android.content.res.TypedArray)1 LinearGradient (android.graphics.LinearGradient)1 Rect (android.graphics.Rect)1 Shader (android.graphics.Shader)1