Search code examples
androidandroid-graphview

How to set Dashed Grid in graphView?


Now i'm using LineGraphView like,

    GraphView graphView = new LineGraphView(this.getActivity(), "GraphView");

this draw line Grid .. but i want dashed line for graphview grid.. i am using jjoe64 graph android that is Graphview-3.1.3.jar

there is any method for that.. thanks in advance


Solution

  • you could override the LineGraphView drawSeries and change the paint object.

    Something like that:

    GraphView graphView = new LineGraphView(this.getActivity(), "GraphView") {
       @Override
       public void drawSeries(Canvas canvas, GraphViewDataInterface[] values, float graphwidth, float graphheight, float border, double minX, double minY, double diffX, double diffY, float horstart, GraphViewSeriesStyle style) {
          paint.setStyle(Style.STROKE);
          paint.setPathEffect(new DashPathEffect(new float[] {10,20}, 0));
          super.drawSeries(...);
       }
    };