GraphView Android,如何更改原始x轴和y轴的厚度?

时间:2017-02-24 15:38:52

标签: android graph android-graphview

我正在使用GraphView库在Android应用中绘制图形,到目前为止我对图书馆非常满意。我在一个固定的帧实时场景中使用它,并注意到x轴和y轴网格线比其他单位网格线更粗。有什么方法可以让它们与其他线条相似吗?

GraphView graph = (GraphView) cardView.findViewById(R.id.graph);

// Set manual X bounds
graph.getViewport().setXAxisBoundsManual(true);
graph.getViewport().setMinX(0);
graph.getViewport().setMaxX(40);

// Set manual Y bounds
graph.getViewport().setYAxisBoundsManual(true);
graph.getViewport().setMinY(-40);
graph.getViewport().setMaxY(60);

// Draw a border between between labels and viewport
graph.getViewport().setDrawBorder(false);

graph.getGridLabelRenderer().setHumanRounding(false);
graph.getGridLabelRenderer().setNumHorizontalLabels(11);
graph.getGridLabelRenderer().setNumVerticalLabels(6);

基本上我想改变这个:

enter image description here

到此:

enter image description here

提前致谢!

2 个答案:

答案 0 :(得分:2)

默认情况下,GridLabelRenderer类有一个setHighlightZeroLines方法true。代码如下:

graphView.getGridLabelRenderer().setHighlightZeroLines(false);

应该做你想做的事。

答案 1 :(得分:1)

请详细查找Line Graph Series:

Line Graph Series in detail

//样式系列

namespace MultipleBrowserTest
{
    public class Browsers_UnityContainer
    {
        public Browsers_UnityContainer(Type type)
        {
        _unityContainer.RegisterType(typeof(IWebDriver), type, new InjectionConstructor());
        Browser = _unityContainer.Resolve<IWebDriver>();

        }

        private IWebDriver Browser { get; set; }
        private readonly UnityContainer _unityContainer = new UnityContainer();

        public IWebDriver Driver
        {
            get { return Browser; }
            set { Browser = value; }
        }
    }
}

//自定义绘制虚线

series.setTitle("Random Curve 1");
series.setColor(Color.GREEN);
series.setDrawDataPoints(true);
series.setDataPointsRadius(10);
series.setThickness(8);