当前位置: 首页 > 工具软件 > unity-XCharts > 使用案例 >

unity3d Xchart的使用

郭浩穰
2023-12-01

xchart现在已经更新到3.0了,网上找的那些代码已经完全不可用了,真的是耽误啊,以后还是直接找原版教程。(学习能力太弱了。。。)
在这个地址有详细介绍:https://gitcode.net/mirrors/monitor1394/unity-ugui-xcharts。
比如坐标轴的改变,是需要先获取,再修改:

var xAxis = chart.GetOrAddChartComponent<XAxis>();
xAxis.splitNumber = 10;
xAxis.boundaryGap = true;
xAxis.type = Axis.AxisType.Category;

以前的是这样:

chart.title.show = true;
        chart.title.text = _title;
        //背景图
        chart.background.gameObject.SetActive(chart.background.show);
        //提示框
        chart.tooltip.show = true;
        chart.tooltip.titleFormatter = " ";
        //图例组件
        chart.legend.show = false;
        //x轴的设置
        chart.xAxis0.show = true;
        chart.xAxis0.type = Axis.AxisType.Category;
        chart.xAxis0.splitNumber = 11;
        chart.xAxis0.boundaryGap = false;
        chart.xAxis0.axisName.show = true;
        chart.xAxis0.axisName.name = xAxisName;
        chart.xAxis1.show = false;
        //y轴的设置
        chart.yAxis0.show = true;
        chart.yAxis0.type = Axis.AxisType.Value;
        chart.yAxis0.show = true;
        chart.yAxis0.splitNumber = 10;
        chart.yAxis0.interval = 1;
        chart.yAxis0.axisLabel.show = true;
        chart.yAxis0.axisName.show = true;
        chart.yAxis0.axisName.name = yAxisName;
        chart.yAxis1.show = false;

这种写法在3.0都不能用了,望像我一样的新手多多注意!

 类似资料: