mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-22 17:00:08 +00:00
整理代码更新文档
This commit is contained in:
@@ -298,11 +298,11 @@ namespace XCharts
|
||||
{
|
||||
if (m_Font == null && m_CustomFont == null)
|
||||
{
|
||||
sb.AppendFormat("warning:theme->font is null");
|
||||
sb.AppendFormat("warning:theme->font is null\n");
|
||||
}
|
||||
if (m_ColorPalette.Length == 0 && m_CustomColorPalette.Count == 0)
|
||||
{
|
||||
sb.AppendFormat("warning:theme->colorPalette is empty");
|
||||
sb.AppendFormat("warning:theme->colorPalette is empty\n");
|
||||
}
|
||||
for (int i = 0; i < m_ColorPalette.Length; i++)
|
||||
{
|
||||
|
||||
@@ -97,17 +97,17 @@ namespace XCharts
|
||||
/// <summary>
|
||||
/// 提示框总内容的字符串模版格式器。支持用 \n 换行。当formatter不为空时,优先使用formatter,否则使用itemFormatter。
|
||||
/// 模板变量有{.}、{a}、{b}、{c}、{d}。
|
||||
/// {.}表示带动态颜色的圆点。
|
||||
/// {a}为系列名serie的name。
|
||||
/// {b}为数据项名serieData的name,或者类目值(如折线图的X轴)。
|
||||
/// {c}为数值。
|
||||
/// {d}为百分比值,注意不带%号。
|
||||
/// {.}为当前所指示或index为0的serie的对应颜色的圆点。
|
||||
/// {a}为当前所指示或index为0的serie的系列名name。
|
||||
/// {b}为当前所指示或index为0的serie的数据项serieData的name,或者类目值(如折线图的X轴)。
|
||||
/// {c}为当前所指示或index为0的serie的y维(dimesion为1)的数值。
|
||||
/// {d}为当前所指示或index为0的serie的y维(dimesion为1)百分比值,注意不带%号。
|
||||
/// {.1}表示指定index为1的serie对应颜色的圆点。
|
||||
/// {a1}、{b1}、{c1}中的1表示指定index为1的serie,{a}默认index为0的serie。
|
||||
/// {a1}、{b1}、{c1}中的1表示指定index为1的serie。
|
||||
/// {c1:2}表示索引为1的serie的当前指示数据项的第3个数据(一个数据项有多个数据,index为2表示第3个数据)。
|
||||
/// {c1:2-2}表示索引为1的serie的第3个数据项的第3个数据(也就是要指定第几个数据项时必须要指定第几个数据)。
|
||||
/// {d1:2:f2}表示单独指定了数值的格式化字符串为f2(不指定时用numericFormatter)。
|
||||
/// 示例:"{a}:{c}"、"{a1}:{c1:f1}"、"{a1}:{c1:1f1}"
|
||||
/// 示例:"{a}:{c}"、"{a1}:{c1:f1}"、"{a1}:{c1:0:f1}"、"{a1}:{c1:1-1:f1}"、
|
||||
/// </summary>
|
||||
public string formatter { get { return m_Formatter; } set { m_Formatter = value; } }
|
||||
/// <summary>
|
||||
|
||||
@@ -65,10 +65,15 @@ namespace XCharts
|
||||
m_Opacity = 1;
|
||||
m_TooltipFormatter = null;
|
||||
m_NumericFormatter = "";
|
||||
m_CornerRadius[0] = 0;
|
||||
m_CornerRadius[1] = 0;
|
||||
m_CornerRadius[2] = 0;
|
||||
m_CornerRadius[3] = 0;
|
||||
if (m_CornerRadius == null)
|
||||
{
|
||||
m_CornerRadius = new float[] { 0, 0, 0, 0 };
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < m_CornerRadius.Length; i++)
|
||||
m_CornerRadius[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace XCharts
|
||||
if (serie.dataCount > 0)
|
||||
{
|
||||
allDataIsEmpty = false;
|
||||
for (int i = 1; i < serie.dataCount; i++)
|
||||
for (int i = 0; i < serie.dataCount; i++)
|
||||
{
|
||||
var serieData = serie.GetSerieData(i);
|
||||
for (int j = 1; j < serieData.data.Count; j++)
|
||||
|
||||
@@ -47,13 +47,12 @@ namespace XCharts
|
||||
if (argsCount <= 0) continue;
|
||||
int targetIndex = 0;
|
||||
char p = GetSerieIndex(args[0].ToString(), ref targetIndex);
|
||||
if (serie == null)
|
||||
if (targetIndex >= 0)
|
||||
{
|
||||
if (targetIndex == -1) continue;
|
||||
serie = series.GetSerie(targetIndex);
|
||||
if (serie == null) continue;
|
||||
}
|
||||
else
|
||||
else if (serie != null)
|
||||
{
|
||||
targetIndex = serie.index;
|
||||
}
|
||||
@@ -150,7 +149,7 @@ namespace XCharts
|
||||
|
||||
private static char GetSerieIndex(string strType, ref int index)
|
||||
{
|
||||
index = 0;
|
||||
index = -1;
|
||||
if (strType.Length > 1)
|
||||
{
|
||||
if (!int.TryParse(strType.Substring(1), out index))
|
||||
|
||||
@@ -218,14 +218,14 @@ namespace XCharts
|
||||
var itemTitle = title;
|
||||
if (!string.IsNullOrEmpty(itemTitle))
|
||||
{
|
||||
FormatterHelper.ReplaceContent(ref itemTitle, dataIndex, tooltip.numericFormatter, serie, null, themeInfo, category, dataZoom);
|
||||
FormatterHelper.ReplaceContent(ref itemTitle, dataIndex, tooltip.numericFormatter, serie, series, themeInfo, category, dataZoom);
|
||||
sb.Append(itemTitle).Append(FormatterHelper.PH_NN);
|
||||
}
|
||||
var dataIndexList = tooltip.runtimeSerieDataIndex[serie.index];
|
||||
foreach (var tempIndex in dataIndexList)
|
||||
{
|
||||
string content = itemFormatter;
|
||||
var foundDot = FormatterHelper.ReplaceContent(ref content, tempIndex, tooltip.numericFormatter, serie, null, themeInfo, category, dataZoom);
|
||||
var foundDot = FormatterHelper.ReplaceContent(ref content, tempIndex, tooltip.numericFormatter, serie, series, themeInfo, category, dataZoom);
|
||||
if (!foundDot)
|
||||
{
|
||||
sb.Append(ChartCached.ColorToDotStr(themeInfo.GetColor(serie.index)));
|
||||
@@ -242,7 +242,7 @@ namespace XCharts
|
||||
needCategory = needCategory || (serie.type == SerieType.Line || serie.type == SerieType.Bar);
|
||||
if (formatTitle)
|
||||
{
|
||||
FormatterHelper.ReplaceContent(ref title, dataIndex, tooltip.numericFormatter, null, series, themeInfo, category, dataZoom);
|
||||
FormatterHelper.ReplaceContent(ref title, dataIndex, tooltip.numericFormatter, serie, series, themeInfo, category, dataZoom);
|
||||
}
|
||||
if (serie.show)
|
||||
{
|
||||
@@ -254,7 +254,7 @@ namespace XCharts
|
||||
continue;
|
||||
}
|
||||
string content = itemFormatter;
|
||||
FormatterHelper.ReplaceContent(ref content, dataIndex, tooltip.numericFormatter, serie, null, themeInfo, category, dataZoom);
|
||||
FormatterHelper.ReplaceContent(ref content, dataIndex, tooltip.numericFormatter, serie, series, themeInfo, category, dataZoom);
|
||||
if (!first) sb.Append(FormatterHelper.PH_NN);
|
||||
sb.Append(ChartCached.ColorToDotStr(themeInfo.GetColor(i)));
|
||||
sb.Append(content);
|
||||
|
||||
Reference in New Issue
Block a user