增加数据更新接口UpdateData

This commit is contained in:
monitor1394
2019-03-16 07:49:36 +08:00
parent e62a3775eb
commit 11931e6350
6 changed files with 76 additions and 43 deletions

View File

@@ -52,11 +52,11 @@ namespace xcharts
float degree = totalDegree * value / dataTotal;
float toDegree = startDegree + degree;
float outSideRadius = pieInfo.outsideRadiusDynamic ?
pieInfo.insideRadius + (pieRadius - pieInfo.insideRadius) * value / dataMax :
float outSideRadius = pieInfo.outsideRadiusDynamic ?
pieInfo.insideRadius + (pieRadius - pieInfo.insideRadius) * value / dataMax :
pieRadius;
ChartUtils.DrawDoughnut(vh, new Vector3(pieCenterX, pieCenterY), pieInfo.insideRadius,
outSideRadius,startDegree, toDegree, themeInfo.GetColor(i));
ChartUtils.DrawDoughnut(vh, new Vector3(pieCenterX, pieCenterY), pieInfo.insideRadius,
outSideRadius, startDegree, toDegree, themeInfo.GetColor(i));
startDegree = toDegree;
}
}
@@ -70,7 +70,7 @@ namespace xcharts
private float GetDataTotal()
{
float total = 0;
for(int i = 0; i < seriesList.Count; i++)
for (int i = 0; i < seriesList.Count; i++)
{
if (legend.IsShowSeries(i))
{
@@ -83,9 +83,9 @@ namespace xcharts
private float GetDataMax()
{
float max = 0;
for(int i = 0; i < seriesList.Count; i++)
for (int i = 0; i < seriesList.Count; i++)
{
if(legend.IsShowSeries(i) && seriesList[i].GetData(0) > max)
if (legend.IsShowSeries(i) && seriesList[i].GetData(0) > max)
{
max = seriesList[i].GetData(0);
}
@@ -98,7 +98,7 @@ namespace xcharts
float diffX = chartWid - pieInfo.left - pieInfo.right;
float diffY = chartHig - pieInfo.top - pieInfo.bottom;
float diff = Mathf.Min(diffX, diffY);
if(pieInfo.outsideRadius <= 0)
if (pieInfo.outsideRadius <= 0)
{
pieRadius = diff / 3 * 2;
pieCenterX = pieInfo.left + pieRadius;