mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-21 16:00:24 +00:00
同步更新部分示例代码对按键的读取逻辑
简化了部分协同程序的使用逻辑
This commit is contained in:
@@ -11,42 +11,33 @@ namespace XCharts.Example
|
||||
private LineChart chart;
|
||||
private float speed = 100f;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
LoopDemo();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
LoopDemo();
|
||||
}
|
||||
|
||||
void LoopDemo()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(CheatSheet());
|
||||
}
|
||||
|
||||
IEnumerator CheatSheet()
|
||||
{
|
||||
StartCoroutine(InitChart());
|
||||
StartCoroutine(ComponentTitle());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(ComponentAxis());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(ComponentGrid());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(ComponentSerie());
|
||||
yield return new WaitForSeconds(4);
|
||||
StartCoroutine(ComponentLegend());
|
||||
yield return new WaitForSeconds(4);
|
||||
StartCoroutine(ComponentTheme());
|
||||
yield return new WaitForSeconds(4);
|
||||
StartCoroutine(ComponentDataZoom());
|
||||
yield return new WaitForSeconds(5);
|
||||
StartCoroutine(ComponentVisualMap());
|
||||
yield return new WaitForSeconds(3);
|
||||
LoopDemo();
|
||||
while (true)
|
||||
{
|
||||
StartCoroutine(ComponentTitle());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(ComponentAxis());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(ComponentGrid());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(ComponentSerie());
|
||||
yield return new WaitForSeconds(4);
|
||||
StartCoroutine(ComponentLegend());
|
||||
yield return new WaitForSeconds(4);
|
||||
StartCoroutine(ComponentTheme());
|
||||
yield return new WaitForSeconds(4);
|
||||
StartCoroutine(ComponentDataZoom());
|
||||
yield return new WaitForSeconds(5);
|
||||
StartCoroutine(ComponentVisualMap());
|
||||
yield return new WaitForSeconds(3);
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator InitChart()
|
||||
@@ -54,8 +45,8 @@ namespace XCharts.Example
|
||||
chart = gameObject.GetComponent<LineChart>();
|
||||
if (chart == null) gameObject.AddComponent<LineChart>();
|
||||
|
||||
chart.GetChartComponent<Title>().show = true;
|
||||
chart.GetChartComponent<Title>().text = "术语解析-组件";
|
||||
chart.GetOrAddChartComponent<Title>().show = true;
|
||||
chart.EnsureChartComponent<Title>().text = "术语解析-组件";
|
||||
|
||||
var grid = chart.GetOrAddChartComponent<GridCoord>();
|
||||
grid.bottom = 30;
|
||||
@@ -81,31 +72,31 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator ComponentTitle()
|
||||
{
|
||||
chart.GetChartComponent<Title>().text = "术语解析 - 组件";
|
||||
chart.GetChartComponent<Title>().subText = "Title 标题:可指定主标题和子标题";
|
||||
chart.GetChartComponent<XAxis>().show = true;
|
||||
chart.GetChartComponent<YAxis>().show = true;
|
||||
chart.GetChartComponent<Legend>().show = false;
|
||||
chart.EnsureChartComponent<Title>().text = "术语解析 - 组件";
|
||||
chart.EnsureChartComponent<Title>().subText = "Title 标题:可指定主标题和子标题";
|
||||
chart.EnsureChartComponent<XAxis>().show = true;
|
||||
chart.EnsureChartComponent<YAxis>().show = true;
|
||||
chart.EnsureChartComponent<Legend>().show = false;
|
||||
chart.series[0].show = false;
|
||||
chart.series[1].show = false;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
chart.GetChartComponent<Title>().show = !chart.GetChartComponent<Title>().show;
|
||||
chart.EnsureChartComponent<Title>().show = !chart.EnsureChartComponent<Title>().show;
|
||||
chart.RefreshChart();
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
}
|
||||
chart.GetChartComponent<Title>().show = true;
|
||||
chart.EnsureChartComponent<Title>().show = true;
|
||||
chart.RefreshChart();
|
||||
}
|
||||
|
||||
IEnumerator ComponentAxis()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "Axis 坐标轴:配置X和Y轴的轴线、刻度、标签等样式外观配置";
|
||||
chart.EnsureChartComponent<Title>().subText = "Axis 坐标轴:配置X和Y轴的轴线、刻度、标签等样式外观配置";
|
||||
chart.series[0].show = false;
|
||||
chart.series[1].show = false;
|
||||
var xAxis = chart.GetChartComponent<XAxis>();
|
||||
var yAxis = chart.GetChartComponent<YAxis>();
|
||||
var xAxis = chart.EnsureChartComponent<XAxis>();
|
||||
var yAxis = chart.EnsureChartComponent<YAxis>();
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
xAxis.show = !xAxis.show;
|
||||
@@ -121,8 +112,8 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator ComponentGrid()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "Grid 网格:调整坐标系边距和颜色等";
|
||||
var grid = chart.GetChartComponent<GridCoord>();
|
||||
chart.EnsureChartComponent<Title>().subText = "Grid 网格:调整坐标系边距和颜色等";
|
||||
var grid = chart.EnsureChartComponent<GridCoord>();
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
grid.backgroundColor = i % 2 == 0 ? Color.clear : Color.grey;
|
||||
@@ -136,7 +127,7 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator ComponentSerie()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "Serie 系列:调整坐标系边距和颜色等";
|
||||
chart.EnsureChartComponent<Title>().subText = "Serie 系列:调整坐标系边距和颜色等";
|
||||
chart.series[0].show = true;
|
||||
chart.series[1].show = true;
|
||||
chart.AnimationReset();
|
||||
@@ -157,10 +148,10 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator ComponentLegend()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "Legend 图例:展示不同系列的名字和颜色,可控制系列显示等";
|
||||
var legend = chart.GetChartComponent<Legend>();
|
||||
chart.EnsureChartComponent<Title>().subText = "Legend 图例:展示不同系列的名字和颜色,可控制系列显示等";
|
||||
var legend = chart.EnsureChartComponent<Legend>();
|
||||
legend.show = true;
|
||||
var grid = chart.GetChartComponent<GridCoord>();
|
||||
var grid = chart.EnsureChartComponent<GridCoord>();
|
||||
grid.top = 80;
|
||||
legend.location.top = 50;
|
||||
chart.RefreshChart();
|
||||
@@ -187,23 +178,23 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator ComponentTheme()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "Theme 主题:可从全局上配置图表的颜色、字体等效果,支持默认主题切换";
|
||||
chart.EnsureChartComponent<Title>().subText = "Theme 主题:可从全局上配置图表的颜色、字体等效果,支持默认主题切换";
|
||||
yield return new WaitForSeconds(1f);
|
||||
chart.GetChartComponent<Title>().subText = "Theme 主题:Light主题";
|
||||
chart.EnsureChartComponent<Title>().subText = "Theme 主题:Light主题";
|
||||
chart.UpdateTheme(ThemeType.Light);
|
||||
yield return new WaitForSeconds(1f);
|
||||
chart.GetChartComponent<Title>().subText = "Theme 主题:Dark主题";
|
||||
chart.EnsureChartComponent<Title>().subText = "Theme 主题:Dark主题";
|
||||
chart.UpdateTheme(ThemeType.Dark);
|
||||
yield return new WaitForSeconds(1f);
|
||||
chart.GetChartComponent<Title>().subText = "Theme 主题:Default主题";
|
||||
chart.EnsureChartComponent<Title>().subText = "Theme 主题:Default主题";
|
||||
chart.UpdateTheme(ThemeType.Default);
|
||||
yield return new WaitForSeconds(1f);
|
||||
}
|
||||
|
||||
IEnumerator ComponentDataZoom()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "DataZoom 区域缩放:可通过拖、拽、缩小、放大来观察细节数据";
|
||||
var grid = chart.GetChartComponent<GridCoord>();
|
||||
chart.EnsureChartComponent<Title>().subText = "DataZoom 区域缩放:可通过拖、拽、缩小、放大来观察细节数据";
|
||||
var grid = chart.EnsureChartComponent<GridCoord>();
|
||||
grid.bottom = 70;
|
||||
|
||||
var dataZoom = chart.GetOrAddChartComponent<DataZoom>();
|
||||
@@ -265,7 +256,7 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator ComponentVisualMap()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "VisualMap 视觉映射:可从全局上配置图表的颜色、字体等效果,支持默认主题切换";
|
||||
chart.EnsureChartComponent<Title>().subText = "VisualMap 视觉映射:可从全局上配置图表的颜色、字体等效果,支持默认主题切换";
|
||||
|
||||
var visualMap = chart.GetOrAddChartComponent<VisualMap>();
|
||||
visualMap.show = true;
|
||||
@@ -292,7 +283,7 @@ namespace XCharts.Example
|
||||
"#a50026"
|
||||
};
|
||||
visualMap.AddColors(colors);
|
||||
var grid = chart.GetChartComponent<GridCoord>();
|
||||
var grid = chart.EnsureChartComponent<GridCoord>();
|
||||
grid.left = 80;
|
||||
grid.bottom = 100;
|
||||
chart.RefreshChart();
|
||||
|
||||
@@ -11,39 +11,30 @@ namespace XCharts.Example
|
||||
private Serie serie;
|
||||
private int m_DataNum = 8;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
LoopDemo();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
LoopDemo();
|
||||
}
|
||||
|
||||
void LoopDemo()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(PieDemo());
|
||||
}
|
||||
|
||||
IEnumerator PieDemo()
|
||||
{
|
||||
StartCoroutine(AddSimpleLine());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(ChangeLineType());
|
||||
yield return new WaitForSeconds(8);
|
||||
StartCoroutine(LineAreaStyleSettings());
|
||||
yield return new WaitForSeconds(5);
|
||||
StartCoroutine(LineArrowSettings());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(LineSymbolSettings());
|
||||
yield return new WaitForSeconds(7);
|
||||
StartCoroutine(LineLabelSettings());
|
||||
yield return new WaitForSeconds(3);
|
||||
StartCoroutine(LineMutilSerie());
|
||||
yield return new WaitForSeconds(5);
|
||||
LoopDemo();
|
||||
while (true)
|
||||
{
|
||||
StartCoroutine(AddSimpleLine());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(ChangeLineType());
|
||||
yield return new WaitForSeconds(8);
|
||||
StartCoroutine(LineAreaStyleSettings());
|
||||
yield return new WaitForSeconds(5);
|
||||
StartCoroutine(LineArrowSettings());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(LineSymbolSettings());
|
||||
yield return new WaitForSeconds(7);
|
||||
StartCoroutine(LineLabelSettings());
|
||||
yield return new WaitForSeconds(3);
|
||||
StartCoroutine(LineMutilSerie());
|
||||
yield return new WaitForSeconds(5);
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator AddSimpleLine()
|
||||
|
||||
@@ -4,7 +4,6 @@ using XCharts.Runtime;
|
||||
namespace XCharts.Example
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
[ExecuteInEditMode]
|
||||
public class Example11_AddSinCurve : MonoBehaviour
|
||||
{
|
||||
private float time;
|
||||
@@ -18,14 +17,14 @@ namespace XCharts.Example
|
||||
{
|
||||
chart = gameObject.AddComponent<LineChart>();
|
||||
}
|
||||
chart.GetChartComponent<Title>().show = true;
|
||||
chart.GetChartComponent<Title>().text = "Sin Curve";
|
||||
chart.EnsureChartComponent<Title>().show = true;
|
||||
chart.EnsureChartComponent<Title>().text = "Sin Curve";
|
||||
|
||||
chart.GetChartComponent<Tooltip>().show = true;
|
||||
chart.GetChartComponent<Legend>().show = false;
|
||||
chart.EnsureChartComponent<Tooltip>().show = true;
|
||||
chart.EnsureChartComponent<Legend>().show = false;
|
||||
|
||||
var xAxis = chart.GetChartComponent<XAxis>();
|
||||
var yAxis = chart.GetChartComponent<YAxis>();
|
||||
var xAxis = chart.EnsureChartComponent<XAxis>();
|
||||
var yAxis = chart.EnsureChartComponent<YAxis>();
|
||||
|
||||
xAxis.show = true;
|
||||
yAxis.show = true;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using UnityEngine;
|
||||
#if INPUT_SYSTEM_ENABLED
|
||||
using Input = XCharts.Runtime.InputHelper;
|
||||
#endif
|
||||
using XCharts.Runtime;
|
||||
|
||||
namespace XCharts.Example
|
||||
|
||||
@@ -11,48 +11,38 @@ namespace XCharts.Example
|
||||
private Serie serie, serie2;
|
||||
private int m_DataNum = 5;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
LoopDemo();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
LoopDemo();
|
||||
}
|
||||
|
||||
void LoopDemo()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(PieDemo());
|
||||
}
|
||||
|
||||
IEnumerator PieDemo()
|
||||
{
|
||||
StartCoroutine(AddSimpleBar());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(BarMutilSerie());
|
||||
yield return new WaitForSeconds(3);
|
||||
StartCoroutine(ZebraBar());
|
||||
yield return new WaitForSeconds(3);
|
||||
StartCoroutine(SameBarAndNotStack());
|
||||
yield return new WaitForSeconds(3);
|
||||
StartCoroutine(SameBarAndStack());
|
||||
yield return new WaitForSeconds(3);
|
||||
StartCoroutine(SameBarAndPercentStack());
|
||||
yield return new WaitForSeconds(10);
|
||||
|
||||
LoopDemo();
|
||||
while (true)
|
||||
{
|
||||
StartCoroutine(AddSimpleBar());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(BarMutilSerie());
|
||||
yield return new WaitForSeconds(3);
|
||||
StartCoroutine(ZebraBar());
|
||||
yield return new WaitForSeconds(3);
|
||||
StartCoroutine(SameBarAndNotStack());
|
||||
yield return new WaitForSeconds(3);
|
||||
StartCoroutine(SameBarAndStack());
|
||||
yield return new WaitForSeconds(3);
|
||||
StartCoroutine(SameBarAndPercentStack());
|
||||
yield return new WaitForSeconds(10);
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator AddSimpleBar()
|
||||
{
|
||||
chart = gameObject.GetComponent<BarChart>();
|
||||
if (chart == null) chart = gameObject.AddComponent<BarChart>();
|
||||
chart.GetChartComponent<Title>().text = "BarChart - 柱状图";
|
||||
chart.GetChartComponent<Title>().subText = "普通柱状图";
|
||||
chart.EnsureChartComponent<Title>().text = "BarChart - 柱状图";
|
||||
chart.EnsureChartComponent<Title>().subText = "普通柱状图";
|
||||
|
||||
var yAxis = chart.GetChartComponent<YAxis>();
|
||||
var yAxis = chart.EnsureChartComponent<YAxis>();
|
||||
yAxis.minMaxType = Axis.AxisMinMaxType.Default;
|
||||
|
||||
chart.RemoveData();
|
||||
@@ -68,7 +58,7 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator BarMutilSerie()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "多条柱状图";
|
||||
chart.EnsureChartComponent<Title>().subText = "多条柱状图";
|
||||
|
||||
float now = serie.barWidth - 0.35f;
|
||||
while (serie.barWidth > 0.35f)
|
||||
@@ -90,7 +80,7 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator ZebraBar()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "斑马柱状图";
|
||||
chart.EnsureChartComponent<Title>().subText = "斑马柱状图";
|
||||
serie.barType = BarType.Zebra;
|
||||
serie2.barType = BarType.Zebra;
|
||||
serie.barZebraWidth = serie.barZebraGap = 4;
|
||||
@@ -101,7 +91,7 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator SameBarAndNotStack()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "非堆叠同柱";
|
||||
chart.EnsureChartComponent<Title>().subText = "非堆叠同柱";
|
||||
serie.barType = serie2.barType = BarType.Normal;
|
||||
serie.stack = "";
|
||||
serie2.stack = "";
|
||||
@@ -112,7 +102,7 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator SameBarAndStack()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "堆叠同柱";
|
||||
chart.EnsureChartComponent<Title>().subText = "堆叠同柱";
|
||||
serie.barType = serie2.barType = BarType.Normal;
|
||||
serie.stack = "samename";
|
||||
serie2.stack = "samename";
|
||||
@@ -132,19 +122,25 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator SameBarAndPercentStack()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "百分比堆叠同柱";
|
||||
chart.EnsureChartComponent<Title>().subText = "百分比堆叠同柱";
|
||||
serie.barType = serie2.barType = BarType.Normal;
|
||||
serie.stack = "samename";
|
||||
serie2.stack = "samename";
|
||||
|
||||
serie.barPercentStack = true;
|
||||
|
||||
serie.AddExtraComponent<LabelStyle>();
|
||||
if (null == serie.label)
|
||||
{
|
||||
serie.AddExtraComponent<LabelStyle>();
|
||||
}
|
||||
serie.label.show = true;
|
||||
serie.label.position = LabelStyle.Position.Center;
|
||||
serie.label.textStyle.color = Color.white;
|
||||
serie.label.formatter = "{d:f0}%";
|
||||
|
||||
if (null == serie2.label)
|
||||
{
|
||||
serie2.AddExtraComponent<LabelStyle>();
|
||||
}
|
||||
serie2.label.show = true;
|
||||
serie2.label.position = LabelStyle.Position.Center;
|
||||
serie2.label.textStyle.color = Color.white;
|
||||
|
||||
@@ -13,45 +13,37 @@ namespace XCharts.Example
|
||||
private float m_RadiusSpeed = 100f;
|
||||
private float m_CenterSpeed = 1f;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
LoopDemo();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
LoopDemo();
|
||||
}
|
||||
|
||||
void LoopDemo()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(PieDemo());
|
||||
}
|
||||
|
||||
IEnumerator PieDemo()
|
||||
{
|
||||
StartCoroutine(PieAdd());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(PieShowLabel());
|
||||
yield return new WaitForSeconds(4);
|
||||
StartCoroutine(Doughnut());
|
||||
yield return new WaitForSeconds(3);
|
||||
StartCoroutine(DoublePie());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(RosePie());
|
||||
yield return new WaitForSeconds(5);
|
||||
LoopDemo();
|
||||
while (true)
|
||||
{
|
||||
StartCoroutine(PieAdd());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(PieShowLabel());
|
||||
yield return new WaitForSeconds(4);
|
||||
StartCoroutine(Doughnut());
|
||||
yield return new WaitForSeconds(3);
|
||||
StartCoroutine(DoublePie());
|
||||
yield return new WaitForSeconds(2);
|
||||
StartCoroutine(RosePie());
|
||||
yield return new WaitForSeconds(5);
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator PieAdd()
|
||||
{
|
||||
chart = gameObject.GetComponent<PieChart>();
|
||||
if (chart == null) chart = gameObject.AddComponent<PieChart>();
|
||||
yield return null;
|
||||
chart.GetChartComponent<Title>().text = "PieChart - 饼图";
|
||||
chart.GetChartComponent<Title>().subText = "基础饼图";
|
||||
|
||||
var legend = chart.GetChartComponent<Legend>();
|
||||
var legend = chart.EnsureChartComponent<Legend>();
|
||||
legend.show = true;
|
||||
legend.location.align = Location.Align.TopLeft;
|
||||
legend.location.top = 60;
|
||||
@@ -72,7 +64,7 @@ namespace XCharts.Example
|
||||
chart.AddData(0, 135, "视频广告");
|
||||
chart.AddData(0, 1548, "搜索引擎");
|
||||
|
||||
chart.onPointerClickPie = delegate(PointerEventData e, int serieIndex, int dataIndex)
|
||||
chart.onPointerClickPie = delegate (PointerEventData e, int serieIndex, int dataIndex)
|
||||
{
|
||||
|
||||
};
|
||||
@@ -81,7 +73,7 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator PieShowLabel()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "显示文本标签";
|
||||
chart.EnsureChartComponent<Title>().subText = "显示文本标签";
|
||||
|
||||
serie.AddExtraComponent<LabelStyle>();
|
||||
serie.label.show = true;
|
||||
@@ -105,7 +97,7 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator Doughnut()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "圆环图";
|
||||
chart.EnsureChartComponent<Title>().subText = "圆环图";
|
||||
serie.radius[0] = 2f;
|
||||
while (serie.radius[0] < serie.radius[1] * 0.7f)
|
||||
{
|
||||
@@ -129,8 +121,7 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator DoublePie()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "多图组合";
|
||||
|
||||
chart.EnsureChartComponent<Title>().subText = "多图组合";
|
||||
serie1 = chart.AddSerie<Pie>("访问来源2");
|
||||
chart.AddData(1, 335, "直达");
|
||||
chart.AddData(1, 679, "营销广告");
|
||||
@@ -146,7 +137,14 @@ namespace XCharts.Example
|
||||
chart.RefreshChart();
|
||||
yield return null;
|
||||
}
|
||||
|
||||
if (null == serie.label)
|
||||
{
|
||||
serie.AddExtraComponent<LabelStyle>();
|
||||
}
|
||||
if (null == serie1.label)
|
||||
{
|
||||
serie1.AddExtraComponent<LabelStyle>();
|
||||
}
|
||||
serie1.label.show = true;
|
||||
serie1.label.position = LabelStyle.Position.Inside;
|
||||
serie1.label.textStyle.color = Color.white;
|
||||
@@ -158,8 +156,8 @@ namespace XCharts.Example
|
||||
|
||||
IEnumerator RosePie()
|
||||
{
|
||||
chart.GetChartComponent<Title>().subText = "玫瑰图";
|
||||
chart.GetChartComponent<Legend>().show = false;
|
||||
chart.EnsureChartComponent<Title>().subText = "玫瑰图";
|
||||
chart.EnsureChartComponent<Legend>().show = false;
|
||||
serie1.ClearData();
|
||||
serie.ClearData();
|
||||
serie1.radius = serie.radius = new float[2] { 0, 80 };
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
#if INPUT_SYSTEM_ENABLED
|
||||
using Input = XCharts.Runtime.InputHelper;
|
||||
#endif
|
||||
namespace XCharts.Example
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
#if INPUT_SYSTEM_ENABLED
|
||||
using Input = XCharts.Runtime.InputHelper;
|
||||
#endif
|
||||
namespace XCharts.Example
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
#if INPUT_SYSTEM_ENABLED
|
||||
using Input = XCharts.Runtime.InputHelper;
|
||||
#endif
|
||||
namespace XCharts.Example
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
#if INPUT_SYSTEM_ENABLED
|
||||
using Input = XCharts.Runtime.InputHelper;
|
||||
#endif
|
||||
namespace XCharts.Example
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
@@ -18,7 +20,7 @@ namespace XCharts.Example
|
||||
{
|
||||
chart = gameObject.AddComponent<CandlestickChart>();
|
||||
}
|
||||
GenerateOHLC(dataCount);
|
||||
AddData();
|
||||
}
|
||||
|
||||
void Update()
|
||||
@@ -29,9 +31,7 @@ namespace XCharts.Example
|
||||
}
|
||||
}
|
||||
|
||||
void AddData() { }
|
||||
|
||||
void GenerateOHLC(int count)
|
||||
void AddData()
|
||||
{
|
||||
chart.ClearData();
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace XCharts.Example
|
||||
var boxVals = new float[4];
|
||||
var dayRange = 12;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
for (int i = 0; i < dataCount; i++)
|
||||
{
|
||||
baseValue = baseValue + Random.Range(0f, 1f) * 30 - 10;
|
||||
for (int j = 0; j < 4; j++)
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
#if INPUT_SYSTEM_ENABLED
|
||||
using Input = XCharts.Runtime.InputHelper;
|
||||
#endif
|
||||
|
||||
namespace XCharts.Example
|
||||
{
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
#if INPUT_SYSTEM_ENABLED
|
||||
using Input = XCharts.Runtime.InputHelper;
|
||||
#endif
|
||||
namespace XCharts.Example
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using XCharts.Runtime;
|
||||
|
||||
#if INPUT_SYSTEM_ENABLED
|
||||
using Input = XCharts.Runtime.InputHelper;
|
||||
#endif
|
||||
namespace XCharts.Example
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using UnityEngine;
|
||||
using XCharts.Runtime;
|
||||
|
||||
#if INPUT_SYSTEM_ENABLED
|
||||
using Input = XCharts.Runtime.InputHelper;
|
||||
#endif
|
||||
namespace XCharts.Example
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
|
||||
@@ -10,5 +10,6 @@
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": []
|
||||
"defineConstraints": [],
|
||||
"versionDefines": []
|
||||
}
|
||||
Reference in New Issue
Block a user