---恢复内容开始---
以“3D BarChart”为例。
1.Select a theme.(选择一个主题模板)
2.Set up categories and groups.(设置类型和组)
3.You can set values from the inspector.(你可以从检查面板中设置值)
4.Creat a new script.(创建一个新脚本)
Note:(1)Names should be as defined in the editor (名字应该在编辑器中被定义过)
(2)Set the value of a bar using the category name and group that are defined in the inspector.(使用检查器中定义的类别名称和组设置栏的值)
5.Creat an object with the sample script! (建立空物体挂在脚本)
6.Experiment with setting view size in the editor.
7.Experiment with values customization.
8.在Categories中设置Bar的样式。
9.Bar Clickded
1 using System.Collections; 2 using System.Collections.Generic; 3 using ChartAndGraph; 4 using UnityEngine; 5 6 public class MyBarSample : MonoBehaviour 7 { 8 public BarChart chart; 9 // Start is called before the first frame update 10 void Start() 11 { 12 13 chart.DataSource.SetValue("koko","one",8); 14 chart.DataSource.SlideValue("koko","one",8,3f); 15 chart.DataSource.SlideValue("juhnko","one",6,5f); 16 } 17 //lets handle a bar click event 18 public void OnBarClick(BarChart.BarEventArgs args) 19 { 20 Debug.Log("点击的类型是:"+args.Category+"所在的组是:"+args.Group+"值为:"+args.Value); 21 } 22 23 }
Hover can be handled the same way.