当前位置:网站首页>Unity accesses chartandgraph chart plug-in
Unity accesses chartandgraph chart plug-in
2022-07-25 05:30:00 【A programmer who is not for whom_】
Unity Medium access ChartAndGraph Chart plugin
explain
Recently, some chart data display needs to be realized in the project , Because it needs some 3D Chart , So I chose ChartAndGraph This chart plug-in , The chart data is read through the background interface Json And analyze , Then call the chart plug-in API Display the data .
One 、 Implementation bar chart
Realization effect

Implementation steps
- Create a column diagram preset as shown in the following figure ,Tools-Charts-Bar-Canvas-Simple Create a column diagram preset .

- By means of Insperctor Set relevant parameters in the panel
Find in the column diagram preset created in the above stepsCanvas Bar ChartScript components , List common settings
Column chart data settings : amongCategoriesNamely X Axial content ( But not under the chart X Data displayed on the axis ),Groups Group name , Click the next three points to modify the move out and other operations .
Y Axis data settings :Y The axis data is on the column chart componentVertical AxisControl on script components , Common settings are as follows :
Format: Contains four data types Number、Time、Date、Date Time Four kinds of data ( Here, only these four data types can be selected , If Y The value of the shaft , The above four types cannot meet , You may need to extend the plug-in to support dynamic specification )
Text Prefix:Y Prefix of axis value
Text Suffix:Y Suffix of axis text
Main Divisions: Is the setting of the primary partition , Below the Total Yes set yes Y How many data does the axis have
Sub Divisions: Is the setting of sub partition , Below the Total Yes set yes Y How many data does the axis have
- Dynamically load data through scripts , Other settings can also be obtained through code , You can try .
canvasBarChart_LDSCL=this.GetComponent<CanvasBarChart>();
// Data loading
canvasBarChart_LDSCL.DataSource.StartBatch();
canvasBarChart_LDSCL.DataSource.SetValue("1 month ", "all", 10);
canvasBarChart_LDSCL.DataSource.SetValue("2 month ", "all", 10);
canvasBarChart_LDSCL.DataSource.SetValue("3 month ", "all", 10);
canvasBarChart_LDSCL.DataSource.SetValue("4 month ", "all", 10);
canvasBarChart_LDSCL.DataSource.SetValue("5 month ", "all", 10);
canvasBarChart_LDSCL.DataSource.SetValue("6 month ", "all", 10);
canvasBarChart_LDSCL.DataSource.SetValue("7 month ", "all", 10);
canvasBarChart_LDSCL.DataSource.EndBatch();
Two 、 Realize line chart
Realization effect

Implementation steps
Create a line chart preset as shown in the following figure , Click on Tools-Charts-Graph-Canvas-Simple Create presets .

By means of Insperctor Set relevant parameters in the panel .
Find in the column diagram preset created in the above stepsGraph ChartScript components , List common settings
Graph Chart Script components :
Fit Margin: You can set X/Y The display start range of the axis
Categories: Line chart data , You can set each group of data
Horizontral View: If you check auto , The start value and end value will automatically match , If you don't want to start from 0 Start , Just uncheck through settingHorizontal View OriginTo set the starting point , adopt Horizontal View Size To set the amount of data
Vertical View: Empathy
Verical Axis(Y Axis settings )The basic use is the same as the column chart above , No longer enumerated

3. Dynamically load data through scripts
graphChart_MJXY=this.GetComponent<GraphChart>();
graphChart_MJXY.DataSource.StartBatch();
graphChart_MJXY.DataSource.ClearCategory("main");
graphChart_MJXY.DataSource.AddPointToCategory("main", 1, 1);
graphChart_MJXY.DataSource.AddPointToCategory("main", 2, 2);
graphChart_MJXY.DataSource.AddPointToCategory("main", 4, 3);
graphChart_MJXY.DataSource.AddPointToCategory("main", 5, 5);
graphChart_MJXY.DataSource.EndBatch();
Problems encountered
Problems encountered in development , Namely X The contents of the axis are displayed , Because this plug-in X/Y The content of the axis only includes Number、Time、Date、DateTime Four preset types , Discontinuous numbers need to be displayed in the development process , Such as 10、11、12、1、2、3, I add an enumeration type dynamically , Then set it dynamically X The value of the shaft . There are also some methods that have been extended .
边栏推荐
- In depth understanding of pre post + +, -- and negative modulus
- The difference between $write and $display in SystemVerilog
- Tips for downloading videos in batches
- background
- ThreadLocal
- Dragon Dragon community released the first Anolis OS Security Guide to escort users' business systems
- LCP插件创建对等VLAN接口
- What should testers do if they encounter a bug that is difficult to reproduce?
- Redis cluster setup (Windows)
- Vim查找替换及正则表达式的使用
猜你喜欢

FinClip实现微信授权登录的三种方案

ThreadLocal

LeetCode第302场周赛

Basset: learning the regulatory code of the accessible genome with deep convolutional neural network

systemverilog中function和task区别

Leetcode 202. 快乐数(一点都不快乐)

Microservice gateway component

STL notes (I): knowledge system

Microservices and related component concepts

Preliminary understanding of Panda3D particle system
随机推荐
自己实现is_base_of
Microservices and related component concepts
Add transition layer to JS page
弹性布局总结
deep报错
ThreadLocal
Render Optimization: repaint and reflow
1310_ Implementation analysis of a printf
微服务及相关组件概念
Atof(), atoi(), atol() functions [detailed]
Zhanrui's first 5g baseband chip was officially released and successfully ranked among the first tier of 5g!
Application of hard coding and streaming integration scheme based on spice protocol in cloud games
Leetcode 237. 删除链表中的节点
In depth understanding of pre post + +, -- and negative modulus
typora+PicGo+阿里云OSS 搭建以及报错解决【转载】
Implementation principle of epoll
flex布局常用属性总结
Solution of win11 blue screen code 0x0000001a
Unity接入ChartAndGraph图表插件
Microservice gateway component