why*_*yoz 1 graphing android android-widget androidplot
是否有线条样式用于虚线,虚线等?
我知道你可以通过将vertexColor设置为null来添加/删除该点,如下例所示:
LineAndPointFormatter blueFormat = new LineAndPointFormatter(Color.rgb(30,144,255), null, null);
Run Code Online (Sandbox Code Playgroud)
但是,我无法在javadoc中找到像"setDottedLine(true)"这样的快速属性设置或类似的东西.我想我可以解析每10个点并在解析时每10个点掉一次,但这可能比需要的开销略高.
是否有使用LineAndPointFormatter创建虚线或通过设置其他小部件属性的解决方法或技巧?
弄清楚了..
LineAndPointFormatter有一个构造函数:
setLinePaint(油漆)
因此,为了绘制虚线,您将使用这样的代码段:
Paint dashPaint = new Paint();
dashPaint.setColor(getResources().getColor(R.color.red));
dashPaint.setStyle(Paint.Style.STROKE);
dashPaint.setStrokeWidth(3);
dashPaint.setPathEffect(new DashPathEffect(new float[] {10,5}, 0));
LineAndPointFormatter redDash = new LineAndPointFormatter(dashPaint.getColor(), null, null);
redDash.setLinePaint(dashPaint);
plot.addSeries(red,redDash);
plot.redraw();
Run Code Online (Sandbox Code Playgroud)