public override double GetDataTotal(int dimension, SerieData serieData = null) { if (serieData == null || serieData.data.Count <= 1) { return(base.GetDataTotal(dimension, serieData)); } return(serieData.GetData(1)); }
private Vector3 GetPolarPos(PolarCoord m_Polar, AngleAxis m_AngleAxis, SerieData serieData, double min, double max, float polarRadius) { var angle = 0f; if (!m_AngleAxis.clockwise) { angle = m_AngleAxis.GetValueAngle((float)serieData.GetData(1)); } else { angle = m_AngleAxis.GetValueAngle((float)serieData.GetData(1)); } var value = serieData.GetData(0); var radius = (float)((value - min) / (max - min) * polarRadius); angle = (angle + 360) % 360; serieData.context.angle = angle; serieData.context.position = ChartHelper.GetPos(m_Polar.context.center, radius, angle, true); return(serieData.context.position); }
public static void ReplaceSerieLabelContent(ref string content, string numericFormatter, int dataCount, double value, double total, string serieName, string category, string dataName, Color color, SerieData serieData) { var mc = s_RegexForSerieLabel.Matches(content); foreach (var m in mc) { var old = m.ToString(); var args = s_RegexSubForSerieLabel.Matches(old); var argsCount = args.Count; if (argsCount <= 0) { continue; } var pstr = args[0].ToString(); var p = pstr.ElementAt(0); var pIndex = -1; if (pstr.Length > 1) { int.TryParse(pstr.Substring(1, pstr.Length - 1), out pIndex); } if (argsCount >= 2) { numericFormatter = args[1].ToString(); } if (p == '.') { content = content.Replace(old, ChartCached.ColorToDotStr(color)); } else if (p == 'a' || p == 'A') { content = content.Replace(old, serieName); } else if (p == 'b' || p == 'B') { content = content.Replace(old, category); } else if (p == 'e' || p == 'E') { content = content.Replace(old, dataName); } else if (p == 'd' || p == 'D') { var rate = total == 0 ? 0 : value / total * 100; content = content.Replace(old, ChartCached.NumberToStr(rate, numericFormatter)); } else if (p == 'c' || p == 'C') { if (pIndex >= 0 && serieData != null) { content = content.Replace(old, ChartCached.NumberToStr(serieData.GetData(pIndex), numericFormatter)); } else { content = content.Replace(old, ChartCached.NumberToStr(value, numericFormatter)); } } else if (p == 'f' || p == 'f') { content = content.Replace(old, ChartCached.NumberToStr(total, numericFormatter)); } else if (p == 'g' || p == 'G') { content = content.Replace(old, ChartCached.NumberToStr(dataCount, numericFormatter)); } } content = TrimAndReplaceLine(content); }