如何在graphView中设置虚线网格?

时间:2014-09-16 09:14:41

标签: android android-graphview

现在我正在使用LineGraphView,

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

这个绘制线网格..但我想要graphview网格的虚线.. 我正在使用jjoe64 graph android,即Graphview-3.1.3.jar

有任何方法可以.. 提前谢谢

1 个答案:

答案 0 :(得分:2)

您可以覆盖LineGraphView drawSeries并更改绘制对象。

类似的东西:

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(...);
   }
};