mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-16 05:10:12 +00:00
增加RingChart环形图
This commit is contained in:
@@ -220,7 +220,7 @@ namespace XCharts
|
||||
/// <param name="yValue">y data</param>
|
||||
/// <param name="dataName">the name of data</param>
|
||||
/// <returns>Returns True on success</returns>
|
||||
public virtual SerieData AddData(string serieName, float xValue, float yValue, string dataName)
|
||||
public virtual SerieData AddData(string serieName, float xValue, float yValue, string dataName = null)
|
||||
{
|
||||
var serieData = m_Series.AddXYData(serieName, xValue, yValue, dataName);
|
||||
if (serieData != null)
|
||||
|
||||
95
Runtime/API/RingChart_API.cs
Normal file
95
Runtime/API/RingChart_API.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
/******************************************/
|
||||
/* */
|
||||
/* Copyright (c) 2018 monitor1394 */
|
||||
/* https://github.com/monitor1394 */
|
||||
/* */
|
||||
/******************************************/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
public partial class RingChart
|
||||
{
|
||||
/// <summary>
|
||||
/// 更新指定系列执行数据项的最大值
|
||||
/// </summary>
|
||||
/// <param name="serieIndex"></param>
|
||||
/// <param name="dataIndex"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpdateMax(int serieIndex, int dataIndex, float value)
|
||||
{
|
||||
var serie = m_Series.GetSerie(serieIndex);
|
||||
if (serie != null)
|
||||
{
|
||||
var serieData = serie.GetSerieData(dataIndex);
|
||||
if (serieData != null)
|
||||
{
|
||||
return serieData.UpdateData(1, value);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新指定系列的所有数据项的最大值
|
||||
/// </summary>
|
||||
/// <param name="serieIndex"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpdateMax(int serieIndex, float value)
|
||||
{
|
||||
var serie = m_Series.GetSerie(serieIndex);
|
||||
if (serie != null)
|
||||
{
|
||||
var flag = true;
|
||||
foreach (var serieData in serie.data)
|
||||
{
|
||||
if (!serieData.UpdateData(1, value)) flag = false;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新第一个系列第一个数据项的最大值
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public bool UpdateMax(float value)
|
||||
{
|
||||
return UpdateMax(0, 0, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the data with the specified maximum value to the specified serie.
|
||||
/// 添加指定最大值的数据到指定系列中。
|
||||
/// </summary>
|
||||
/// <param name="serieName">the name of serie</param>
|
||||
/// <param name="value">the data</param>
|
||||
/// <param name="max">the max data</param>
|
||||
/// <param name="dataName">the name of data</param>
|
||||
/// <returns>Returns True on success</returns>
|
||||
public override SerieData AddData(string serieName, float value, float max, string dataName = null)
|
||||
{
|
||||
return base.AddData(serieName, value, max, dataName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the data with the specified maximum value to the specified serie.
|
||||
/// 添加指定最大值的数据到指定系列中。
|
||||
/// </summary>
|
||||
/// <param name="serieIndex">the index of serie</param>
|
||||
/// <param name="value">the data</param>
|
||||
/// <param name="max">the max data</param>
|
||||
/// <param name="dataName">the name of data</param>
|
||||
/// <returns>Returns True on success</returns>
|
||||
public override SerieData AddData(int serieIndex, float value, float max, string dataName = null)
|
||||
{
|
||||
return base.AddData(serieIndex, value, max, dataName);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/API/RingChart_API.cs.meta
Normal file
11
Runtime/API/RingChart_API.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a1cd7e0dade8470cb91d6a7971ff022
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user