同步更新部分示例代码对按键的读取逻辑

简化了部分协同程序的使用逻辑
This commit is contained in:
边上海
2023-01-30 10:41:41 +08:00
parent 633456ada0
commit c9cd4ee38a
15 changed files with 160 additions and 166 deletions

View File

@@ -11,25 +11,16 @@ namespace XCharts.Example
private LineChart chart; private LineChart chart;
private float speed = 100f; private float speed = 100f;
void Awake()
{
LoopDemo();
}
private void OnEnable() private void OnEnable()
{ {
LoopDemo();
}
void LoopDemo()
{
StopAllCoroutines();
StartCoroutine(CheatSheet()); StartCoroutine(CheatSheet());
} }
IEnumerator CheatSheet() IEnumerator CheatSheet()
{ {
StartCoroutine(InitChart()); StartCoroutine(InitChart());
while (true)
{
StartCoroutine(ComponentTitle()); StartCoroutine(ComponentTitle());
yield return new WaitForSeconds(2); yield return new WaitForSeconds(2);
StartCoroutine(ComponentAxis()); StartCoroutine(ComponentAxis());
@@ -46,7 +37,7 @@ namespace XCharts.Example
yield return new WaitForSeconds(5); yield return new WaitForSeconds(5);
StartCoroutine(ComponentVisualMap()); StartCoroutine(ComponentVisualMap());
yield return new WaitForSeconds(3); yield return new WaitForSeconds(3);
LoopDemo(); }
} }
IEnumerator InitChart() IEnumerator InitChart()
@@ -54,8 +45,8 @@ namespace XCharts.Example
chart = gameObject.GetComponent<LineChart>(); chart = gameObject.GetComponent<LineChart>();
if (chart == null) gameObject.AddComponent<LineChart>(); if (chart == null) gameObject.AddComponent<LineChart>();
chart.GetChartComponent<Title>().show = true; chart.GetOrAddChartComponent<Title>().show = true;
chart.GetChartComponent<Title>().text = "术语解析-组件"; chart.EnsureChartComponent<Title>().text = "术语解析-组件";
var grid = chart.GetOrAddChartComponent<GridCoord>(); var grid = chart.GetOrAddChartComponent<GridCoord>();
grid.bottom = 30; grid.bottom = 30;
@@ -81,31 +72,31 @@ namespace XCharts.Example
IEnumerator ComponentTitle() IEnumerator ComponentTitle()
{ {
chart.GetChartComponent<Title>().text = "术语解析 - 组件"; chart.EnsureChartComponent<Title>().text = "术语解析 - 组件";
chart.GetChartComponent<Title>().subText = "Title 标题:可指定主标题和子标题"; chart.EnsureChartComponent<Title>().subText = "Title 标题:可指定主标题和子标题";
chart.GetChartComponent<XAxis>().show = true; chart.EnsureChartComponent<XAxis>().show = true;
chart.GetChartComponent<YAxis>().show = true; chart.EnsureChartComponent<YAxis>().show = true;
chart.GetChartComponent<Legend>().show = false; chart.EnsureChartComponent<Legend>().show = false;
chart.series[0].show = false; chart.series[0].show = false;
chart.series[1].show = false; chart.series[1].show = false;
for (int i = 0; i < 4; i++) 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(); chart.RefreshChart();
yield return new WaitForSeconds(0.2f); yield return new WaitForSeconds(0.2f);
} }
chart.GetChartComponent<Title>().show = true; chart.EnsureChartComponent<Title>().show = true;
chart.RefreshChart(); chart.RefreshChart();
} }
IEnumerator ComponentAxis() IEnumerator ComponentAxis()
{ {
chart.GetChartComponent<Title>().subText = "Axis 坐标轴配置X和Y轴的轴线、刻度、标签等样式外观配置"; chart.EnsureChartComponent<Title>().subText = "Axis 坐标轴配置X和Y轴的轴线、刻度、标签等样式外观配置";
chart.series[0].show = false; chart.series[0].show = false;
chart.series[1].show = false; chart.series[1].show = false;
var xAxis = chart.GetChartComponent<XAxis>(); var xAxis = chart.EnsureChartComponent<XAxis>();
var yAxis = chart.GetChartComponent<YAxis>(); var yAxis = chart.EnsureChartComponent<YAxis>();
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
xAxis.show = !xAxis.show; xAxis.show = !xAxis.show;
@@ -121,8 +112,8 @@ namespace XCharts.Example
IEnumerator ComponentGrid() IEnumerator ComponentGrid()
{ {
chart.GetChartComponent<Title>().subText = "Grid 网格:调整坐标系边距和颜色等"; chart.EnsureChartComponent<Title>().subText = "Grid 网格:调整坐标系边距和颜色等";
var grid = chart.GetChartComponent<GridCoord>(); var grid = chart.EnsureChartComponent<GridCoord>();
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
grid.backgroundColor = i % 2 == 0 ? Color.clear : Color.grey; grid.backgroundColor = i % 2 == 0 ? Color.clear : Color.grey;
@@ -136,7 +127,7 @@ namespace XCharts.Example
IEnumerator ComponentSerie() IEnumerator ComponentSerie()
{ {
chart.GetChartComponent<Title>().subText = "Serie 系列:调整坐标系边距和颜色等"; chart.EnsureChartComponent<Title>().subText = "Serie 系列:调整坐标系边距和颜色等";
chart.series[0].show = true; chart.series[0].show = true;
chart.series[1].show = true; chart.series[1].show = true;
chart.AnimationReset(); chart.AnimationReset();
@@ -157,10 +148,10 @@ namespace XCharts.Example
IEnumerator ComponentLegend() IEnumerator ComponentLegend()
{ {
chart.GetChartComponent<Title>().subText = "Legend 图例:展示不同系列的名字和颜色,可控制系列显示等"; chart.EnsureChartComponent<Title>().subText = "Legend 图例:展示不同系列的名字和颜色,可控制系列显示等";
var legend = chart.GetChartComponent<Legend>(); var legend = chart.EnsureChartComponent<Legend>();
legend.show = true; legend.show = true;
var grid = chart.GetChartComponent<GridCoord>(); var grid = chart.EnsureChartComponent<GridCoord>();
grid.top = 80; grid.top = 80;
legend.location.top = 50; legend.location.top = 50;
chart.RefreshChart(); chart.RefreshChart();
@@ -187,23 +178,23 @@ namespace XCharts.Example
IEnumerator ComponentTheme() IEnumerator ComponentTheme()
{ {
chart.GetChartComponent<Title>().subText = "Theme 主题:可从全局上配置图表的颜色、字体等效果,支持默认主题切换"; chart.EnsureChartComponent<Title>().subText = "Theme 主题:可从全局上配置图表的颜色、字体等效果,支持默认主题切换";
yield return new WaitForSeconds(1f); yield return new WaitForSeconds(1f);
chart.GetChartComponent<Title>().subText = "Theme 主题Light主题"; chart.EnsureChartComponent<Title>().subText = "Theme 主题Light主题";
chart.UpdateTheme(ThemeType.Light); chart.UpdateTheme(ThemeType.Light);
yield return new WaitForSeconds(1f); yield return new WaitForSeconds(1f);
chart.GetChartComponent<Title>().subText = "Theme 主题Dark主题"; chart.EnsureChartComponent<Title>().subText = "Theme 主题Dark主题";
chart.UpdateTheme(ThemeType.Dark); chart.UpdateTheme(ThemeType.Dark);
yield return new WaitForSeconds(1f); yield return new WaitForSeconds(1f);
chart.GetChartComponent<Title>().subText = "Theme 主题Default主题"; chart.EnsureChartComponent<Title>().subText = "Theme 主题Default主题";
chart.UpdateTheme(ThemeType.Default); chart.UpdateTheme(ThemeType.Default);
yield return new WaitForSeconds(1f); yield return new WaitForSeconds(1f);
} }
IEnumerator ComponentDataZoom() IEnumerator ComponentDataZoom()
{ {
chart.GetChartComponent<Title>().subText = "DataZoom 区域缩放:可通过拖、拽、缩小、放大来观察细节数据"; chart.EnsureChartComponent<Title>().subText = "DataZoom 区域缩放:可通过拖、拽、缩小、放大来观察细节数据";
var grid = chart.GetChartComponent<GridCoord>(); var grid = chart.EnsureChartComponent<GridCoord>();
grid.bottom = 70; grid.bottom = 70;
var dataZoom = chart.GetOrAddChartComponent<DataZoom>(); var dataZoom = chart.GetOrAddChartComponent<DataZoom>();
@@ -265,7 +256,7 @@ namespace XCharts.Example
IEnumerator ComponentVisualMap() IEnumerator ComponentVisualMap()
{ {
chart.GetChartComponent<Title>().subText = "VisualMap 视觉映射:可从全局上配置图表的颜色、字体等效果,支持默认主题切换"; chart.EnsureChartComponent<Title>().subText = "VisualMap 视觉映射:可从全局上配置图表的颜色、字体等效果,支持默认主题切换";
var visualMap = chart.GetOrAddChartComponent<VisualMap>(); var visualMap = chart.GetOrAddChartComponent<VisualMap>();
visualMap.show = true; visualMap.show = true;
@@ -292,7 +283,7 @@ namespace XCharts.Example
"#a50026" "#a50026"
}; };
visualMap.AddColors(colors); visualMap.AddColors(colors);
var grid = chart.GetChartComponent<GridCoord>(); var grid = chart.EnsureChartComponent<GridCoord>();
grid.left = 80; grid.left = 80;
grid.bottom = 100; grid.bottom = 100;
chart.RefreshChart(); chart.RefreshChart();

View File

@@ -11,23 +11,14 @@ namespace XCharts.Example
private Serie serie; private Serie serie;
private int m_DataNum = 8; private int m_DataNum = 8;
void Awake()
{
LoopDemo();
}
private void OnEnable() private void OnEnable()
{ {
LoopDemo();
}
void LoopDemo()
{
StopAllCoroutines();
StartCoroutine(PieDemo()); StartCoroutine(PieDemo());
} }
IEnumerator PieDemo() IEnumerator PieDemo()
{
while (true)
{ {
StartCoroutine(AddSimpleLine()); StartCoroutine(AddSimpleLine());
yield return new WaitForSeconds(2); yield return new WaitForSeconds(2);
@@ -43,7 +34,7 @@ namespace XCharts.Example
yield return new WaitForSeconds(3); yield return new WaitForSeconds(3);
StartCoroutine(LineMutilSerie()); StartCoroutine(LineMutilSerie());
yield return new WaitForSeconds(5); yield return new WaitForSeconds(5);
LoopDemo(); }
} }
IEnumerator AddSimpleLine() IEnumerator AddSimpleLine()

View File

@@ -4,7 +4,6 @@ using XCharts.Runtime;
namespace XCharts.Example namespace XCharts.Example
{ {
[DisallowMultipleComponent] [DisallowMultipleComponent]
[ExecuteInEditMode]
public class Example11_AddSinCurve : MonoBehaviour public class Example11_AddSinCurve : MonoBehaviour
{ {
private float time; private float time;
@@ -18,14 +17,14 @@ namespace XCharts.Example
{ {
chart = gameObject.AddComponent<LineChart>(); chart = gameObject.AddComponent<LineChart>();
} }
chart.GetChartComponent<Title>().show = true; chart.EnsureChartComponent<Title>().show = true;
chart.GetChartComponent<Title>().text = "Sin Curve"; chart.EnsureChartComponent<Title>().text = "Sin Curve";
chart.GetChartComponent<Tooltip>().show = true; chart.EnsureChartComponent<Tooltip>().show = true;
chart.GetChartComponent<Legend>().show = false; chart.EnsureChartComponent<Legend>().show = false;
var xAxis = chart.GetChartComponent<XAxis>(); var xAxis = chart.EnsureChartComponent<XAxis>();
var yAxis = chart.GetChartComponent<YAxis>(); var yAxis = chart.EnsureChartComponent<YAxis>();
xAxis.show = true; xAxis.show = true;
yAxis.show = true; yAxis.show = true;

View File

@@ -1,4 +1,7 @@
using UnityEngine; using UnityEngine;
#if INPUT_SYSTEM_ENABLED
using Input = XCharts.Runtime.InputHelper;
#endif
using XCharts.Runtime; using XCharts.Runtime;
namespace XCharts.Example namespace XCharts.Example

View File

@@ -11,23 +11,14 @@ namespace XCharts.Example
private Serie serie, serie2; private Serie serie, serie2;
private int m_DataNum = 5; private int m_DataNum = 5;
void Awake()
{
LoopDemo();
}
private void OnEnable() private void OnEnable()
{ {
LoopDemo();
}
void LoopDemo()
{
StopAllCoroutines();
StartCoroutine(PieDemo()); StartCoroutine(PieDemo());
} }
IEnumerator PieDemo() IEnumerator PieDemo()
{
while (true)
{ {
StartCoroutine(AddSimpleBar()); StartCoroutine(AddSimpleBar());
yield return new WaitForSeconds(2); yield return new WaitForSeconds(2);
@@ -41,18 +32,17 @@ namespace XCharts.Example
yield return new WaitForSeconds(3); yield return new WaitForSeconds(3);
StartCoroutine(SameBarAndPercentStack()); StartCoroutine(SameBarAndPercentStack());
yield return new WaitForSeconds(10); yield return new WaitForSeconds(10);
}
LoopDemo();
} }
IEnumerator AddSimpleBar() IEnumerator AddSimpleBar()
{ {
chart = gameObject.GetComponent<BarChart>(); chart = gameObject.GetComponent<BarChart>();
if (chart == null) chart = gameObject.AddComponent<BarChart>(); if (chart == null) chart = gameObject.AddComponent<BarChart>();
chart.GetChartComponent<Title>().text = "BarChart - 柱状图"; chart.EnsureChartComponent<Title>().text = "BarChart - 柱状图";
chart.GetChartComponent<Title>().subText = "普通柱状图"; chart.EnsureChartComponent<Title>().subText = "普通柱状图";
var yAxis = chart.GetChartComponent<YAxis>(); var yAxis = chart.EnsureChartComponent<YAxis>();
yAxis.minMaxType = Axis.AxisMinMaxType.Default; yAxis.minMaxType = Axis.AxisMinMaxType.Default;
chart.RemoveData(); chart.RemoveData();
@@ -68,7 +58,7 @@ namespace XCharts.Example
IEnumerator BarMutilSerie() IEnumerator BarMutilSerie()
{ {
chart.GetChartComponent<Title>().subText = "多条柱状图"; chart.EnsureChartComponent<Title>().subText = "多条柱状图";
float now = serie.barWidth - 0.35f; float now = serie.barWidth - 0.35f;
while (serie.barWidth > 0.35f) while (serie.barWidth > 0.35f)
@@ -90,7 +80,7 @@ namespace XCharts.Example
IEnumerator ZebraBar() IEnumerator ZebraBar()
{ {
chart.GetChartComponent<Title>().subText = "斑马柱状图"; chart.EnsureChartComponent<Title>().subText = "斑马柱状图";
serie.barType = BarType.Zebra; serie.barType = BarType.Zebra;
serie2.barType = BarType.Zebra; serie2.barType = BarType.Zebra;
serie.barZebraWidth = serie.barZebraGap = 4; serie.barZebraWidth = serie.barZebraGap = 4;
@@ -101,7 +91,7 @@ namespace XCharts.Example
IEnumerator SameBarAndNotStack() IEnumerator SameBarAndNotStack()
{ {
chart.GetChartComponent<Title>().subText = "非堆叠同柱"; chart.EnsureChartComponent<Title>().subText = "非堆叠同柱";
serie.barType = serie2.barType = BarType.Normal; serie.barType = serie2.barType = BarType.Normal;
serie.stack = ""; serie.stack = "";
serie2.stack = ""; serie2.stack = "";
@@ -112,7 +102,7 @@ namespace XCharts.Example
IEnumerator SameBarAndStack() IEnumerator SameBarAndStack()
{ {
chart.GetChartComponent<Title>().subText = "堆叠同柱"; chart.EnsureChartComponent<Title>().subText = "堆叠同柱";
serie.barType = serie2.barType = BarType.Normal; serie.barType = serie2.barType = BarType.Normal;
serie.stack = "samename"; serie.stack = "samename";
serie2.stack = "samename"; serie2.stack = "samename";
@@ -132,19 +122,25 @@ namespace XCharts.Example
IEnumerator SameBarAndPercentStack() IEnumerator SameBarAndPercentStack()
{ {
chart.GetChartComponent<Title>().subText = "百分比堆叠同柱"; chart.EnsureChartComponent<Title>().subText = "百分比堆叠同柱";
serie.barType = serie2.barType = BarType.Normal; serie.barType = serie2.barType = BarType.Normal;
serie.stack = "samename"; serie.stack = "samename";
serie2.stack = "samename"; serie2.stack = "samename";
serie.barPercentStack = true; serie.barPercentStack = true;
if (null == serie.label)
{
serie.AddExtraComponent<LabelStyle>(); serie.AddExtraComponent<LabelStyle>();
}
serie.label.show = true; serie.label.show = true;
serie.label.position = LabelStyle.Position.Center; serie.label.position = LabelStyle.Position.Center;
serie.label.textStyle.color = Color.white; serie.label.textStyle.color = Color.white;
serie.label.formatter = "{d:f0}%"; serie.label.formatter = "{d:f0}%";
if (null == serie2.label)
{
serie2.AddExtraComponent<LabelStyle>();
}
serie2.label.show = true; serie2.label.show = true;
serie2.label.position = LabelStyle.Position.Center; serie2.label.position = LabelStyle.Position.Center;
serie2.label.textStyle.color = Color.white; serie2.label.textStyle.color = Color.white;

View File

@@ -13,23 +13,14 @@ namespace XCharts.Example
private float m_RadiusSpeed = 100f; private float m_RadiusSpeed = 100f;
private float m_CenterSpeed = 1f; private float m_CenterSpeed = 1f;
void Awake()
{
LoopDemo();
}
private void OnEnable() private void OnEnable()
{ {
LoopDemo();
}
void LoopDemo()
{
StopAllCoroutines();
StartCoroutine(PieDemo()); StartCoroutine(PieDemo());
} }
IEnumerator PieDemo() IEnumerator PieDemo()
{
while (true)
{ {
StartCoroutine(PieAdd()); StartCoroutine(PieAdd());
yield return new WaitForSeconds(2); yield return new WaitForSeconds(2);
@@ -41,17 +32,18 @@ namespace XCharts.Example
yield return new WaitForSeconds(2); yield return new WaitForSeconds(2);
StartCoroutine(RosePie()); StartCoroutine(RosePie());
yield return new WaitForSeconds(5); yield return new WaitForSeconds(5);
LoopDemo(); }
} }
IEnumerator PieAdd() IEnumerator PieAdd()
{ {
chart = gameObject.GetComponent<PieChart>(); chart = gameObject.GetComponent<PieChart>();
if (chart == null) chart = gameObject.AddComponent<PieChart>(); if (chart == null) chart = gameObject.AddComponent<PieChart>();
yield return null;
chart.GetChartComponent<Title>().text = "PieChart - 饼图"; chart.GetChartComponent<Title>().text = "PieChart - 饼图";
chart.GetChartComponent<Title>().subText = "基础饼图"; chart.GetChartComponent<Title>().subText = "基础饼图";
var legend = chart.GetChartComponent<Legend>(); var legend = chart.EnsureChartComponent<Legend>();
legend.show = true; legend.show = true;
legend.location.align = Location.Align.TopLeft; legend.location.align = Location.Align.TopLeft;
legend.location.top = 60; legend.location.top = 60;
@@ -72,7 +64,7 @@ namespace XCharts.Example
chart.AddData(0, 135, "视频广告"); chart.AddData(0, 135, "视频广告");
chart.AddData(0, 1548, "搜索引擎"); 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() IEnumerator PieShowLabel()
{ {
chart.GetChartComponent<Title>().subText = "显示文本标签"; chart.EnsureChartComponent<Title>().subText = "显示文本标签";
serie.AddExtraComponent<LabelStyle>(); serie.AddExtraComponent<LabelStyle>();
serie.label.show = true; serie.label.show = true;
@@ -105,7 +97,7 @@ namespace XCharts.Example
IEnumerator Doughnut() IEnumerator Doughnut()
{ {
chart.GetChartComponent<Title>().subText = "圆环图"; chart.EnsureChartComponent<Title>().subText = "圆环图";
serie.radius[0] = 2f; serie.radius[0] = 2f;
while (serie.radius[0] < serie.radius[1] * 0.7f) while (serie.radius[0] < serie.radius[1] * 0.7f)
{ {
@@ -129,8 +121,7 @@ namespace XCharts.Example
IEnumerator DoublePie() IEnumerator DoublePie()
{ {
chart.GetChartComponent<Title>().subText = "多图组合"; chart.EnsureChartComponent<Title>().subText = "多图组合";
serie1 = chart.AddSerie<Pie>("访问来源2"); serie1 = chart.AddSerie<Pie>("访问来源2");
chart.AddData(1, 335, "直达"); chart.AddData(1, 335, "直达");
chart.AddData(1, 679, "营销广告"); chart.AddData(1, 679, "营销广告");
@@ -146,7 +137,14 @@ namespace XCharts.Example
chart.RefreshChart(); chart.RefreshChart();
yield return null; yield return null;
} }
if (null == serie.label)
{
serie.AddExtraComponent<LabelStyle>();
}
if (null == serie1.label)
{
serie1.AddExtraComponent<LabelStyle>();
}
serie1.label.show = true; serie1.label.show = true;
serie1.label.position = LabelStyle.Position.Inside; serie1.label.position = LabelStyle.Position.Inside;
serie1.label.textStyle.color = Color.white; serie1.label.textStyle.color = Color.white;
@@ -158,8 +156,8 @@ namespace XCharts.Example
IEnumerator RosePie() IEnumerator RosePie()
{ {
chart.GetChartComponent<Title>().subText = "玫瑰图"; chart.EnsureChartComponent<Title>().subText = "玫瑰图";
chart.GetChartComponent<Legend>().show = false; chart.EnsureChartComponent<Legend>().show = false;
serie1.ClearData(); serie1.ClearData();
serie.ClearData(); serie.ClearData();
serie1.radius = serie.radius = new float[2] { 0, 80 }; serie1.radius = serie.radius = new float[2] { 0, 80 };

View File

@@ -1,6 +1,8 @@
using UnityEngine; using UnityEngine;
using XCharts.Runtime; using XCharts.Runtime;
#if INPUT_SYSTEM_ENABLED
using Input = XCharts.Runtime.InputHelper;
#endif
namespace XCharts.Example namespace XCharts.Example
{ {
[DisallowMultipleComponent] [DisallowMultipleComponent]

View File

@@ -1,6 +1,8 @@
using UnityEngine; using UnityEngine;
using XCharts.Runtime; using XCharts.Runtime;
#if INPUT_SYSTEM_ENABLED
using Input = XCharts.Runtime.InputHelper;
#endif
namespace XCharts.Example namespace XCharts.Example
{ {
[DisallowMultipleComponent] [DisallowMultipleComponent]

View File

@@ -1,6 +1,8 @@
using UnityEngine; using UnityEngine;
using XCharts.Runtime; using XCharts.Runtime;
#if INPUT_SYSTEM_ENABLED
using Input = XCharts.Runtime.InputHelper;
#endif
namespace XCharts.Example namespace XCharts.Example
{ {
[DisallowMultipleComponent] [DisallowMultipleComponent]

View File

@@ -1,6 +1,8 @@
using UnityEngine; using UnityEngine;
using XCharts.Runtime; using XCharts.Runtime;
#if INPUT_SYSTEM_ENABLED
using Input = XCharts.Runtime.InputHelper;
#endif
namespace XCharts.Example namespace XCharts.Example
{ {
[DisallowMultipleComponent] [DisallowMultipleComponent]
@@ -18,7 +20,7 @@ namespace XCharts.Example
{ {
chart = gameObject.AddComponent<CandlestickChart>(); chart = gameObject.AddComponent<CandlestickChart>();
} }
GenerateOHLC(dataCount); AddData();
} }
void Update() void Update()
@@ -29,9 +31,7 @@ namespace XCharts.Example
} }
} }
void AddData() { } void AddData()
void GenerateOHLC(int count)
{ {
chart.ClearData(); chart.ClearData();
@@ -40,7 +40,7 @@ namespace XCharts.Example
var boxVals = new float[4]; var boxVals = new float[4];
var dayRange = 12; 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; baseValue = baseValue + Random.Range(0f, 1f) * 30 - 10;
for (int j = 0; j < 4; j++) for (int j = 0; j < 4; j++)

View File

@@ -1,5 +1,8 @@
using UnityEngine; using UnityEngine;
using XCharts.Runtime; using XCharts.Runtime;
#if INPUT_SYSTEM_ENABLED
using Input = XCharts.Runtime.InputHelper;
#endif
namespace XCharts.Example namespace XCharts.Example
{ {

View File

@@ -1,6 +1,8 @@
using UnityEngine; using UnityEngine;
using XCharts.Runtime; using XCharts.Runtime;
#if INPUT_SYSTEM_ENABLED
using Input = XCharts.Runtime.InputHelper;
#endif
namespace XCharts.Example namespace XCharts.Example
{ {
[DisallowMultipleComponent] [DisallowMultipleComponent]

View File

@@ -1,7 +1,9 @@
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using XCharts.Runtime; using XCharts.Runtime;
#if INPUT_SYSTEM_ENABLED
using Input = XCharts.Runtime.InputHelper;
#endif
namespace XCharts.Example namespace XCharts.Example
{ {
[DisallowMultipleComponent] [DisallowMultipleComponent]

View File

@@ -1,6 +1,8 @@
using UnityEngine; using UnityEngine;
using XCharts.Runtime; using XCharts.Runtime;
#if INPUT_SYSTEM_ENABLED
using Input = XCharts.Runtime.InputHelper;
#endif
namespace XCharts.Example namespace XCharts.Example
{ {
[DisallowMultipleComponent] [DisallowMultipleComponent]

View File

@@ -10,5 +10,6 @@
"overrideReferences": false, "overrideReferences": false,
"precompiledReferences": [], "precompiledReferences": [],
"autoReferenced": true, "autoReferenced": true,
"defineConstraints": [] "defineConstraints": [],
"versionDefines": []
} }