public static SerieSymbol GetSerieSymbol(Serie serie, SerieData serieData) { if (!serie.IsPerformanceMode() && serieData.symbol != null) { return(serieData.symbol); } else { return(serie.symbol); } }
public static AreaStyle GetAreaStyle(Serie serie, SerieData serieData) { if (serieData != null && serieData.areaStyle != null) { return(serieData.areaStyle); } else { return(serie.areaStyle); } }
public static TitleStyle GetTitleStyle(Serie serie, SerieData serieData) { if (serieData != null && serieData.titleStyle != null) { return(serieData.titleStyle); } else { return(serie.titleStyle); } }
private void DrawCenter(VertexHelper vh, Serie serie, SerieData serieData, float insideRadius, bool last) { var itemStyle = SerieHelper.GetItemStyle(serie, serieData); if (!ChartHelper.IsClearColor(itemStyle.centerColor) && last) { var radius = insideRadius - itemStyle.centerGap; var smoothness = chart.settings.cicleSmoothness; UGL.DrawCricle(vh, serie.context.center, radius, itemStyle.centerColor, smoothness); } }
public static LineStyle GetLineStyle(Serie serie, SerieData serieData) { if (serieData != null && serieData.lineStyle != null) { return(serieData.lineStyle); } else { return(serie.lineStyle); } }
public void Reset() { canShowLabel = true; highlight = false; parent = null; symbol = null; rect = Rect.zero; subRect = Rect.zero; children.Clear(); dataPoints.Clear(); dataLabels.Clear(); }
public static string GetItemNumericFormatter(Tooltip tooltip, Serie serie, SerieData serieData) { var itemStyle = SerieHelper.GetItemStyle(serie, serieData); if (!string.IsNullOrEmpty(itemStyle.numericFormatter)) { return(itemStyle.numericFormatter); } else { return(tooltip.numericFormatter); } }
public static float GetSymbolBorder(Serie serie, SerieData serieData, ThemeStyle theme, bool highlight, float defaultWidth) { var itemStyle = GetItemStyle(serie, serieData, highlight); if (itemStyle != null && itemStyle.borderWidth != 0) { return(itemStyle.borderWidth); } else { return(defaultWidth); } }
public static Color32 GetSymbolBorderColor(Serie serie, SerieData serieData, ThemeStyle theme, bool highlight) { var itemStyle = GetItemStyle(serie, serieData, highlight); if (itemStyle != null && !ChartHelper.IsClearColor(itemStyle.borderColor)) { return(itemStyle.borderColor); } else { return(serie.itemStyle.borderColor); } }
public static float GetSymbolBorder(Serie serie, SerieData serieData, ThemeStyle theme, bool highlight) { var itemStyle = GetItemStyle(serie, serieData, highlight); if (itemStyle != null && itemStyle.borderWidth != 0) { return(itemStyle.borderWidth); } else { return(serie.lineStyle.GetWidth(theme.serie.lineWidth) * 2); } }
public static string GetItemMarker(Serie serie, SerieData serieData, string defaultMarker = null) { var itemStyle = SerieHelper.GetItemStyle(serie, serieData); if (!string.IsNullOrEmpty(itemStyle.itemMarker)) { return(itemStyle.itemMarker); } else { return(defaultMarker); } }
public static float[] GetSymbolCornerRadius(Serie serie, SerieData serieData, bool highlight) { var itemStyle = GetItemStyle(serie, serieData, highlight); if (itemStyle != null) { return(itemStyle.cornerRadius); } else { return(null); } }
private void DrawBorder(VertexHelper vh, Serie serie, SerieData serieData, float insideRadius, float outsideRadius) { var itemStyle = SerieHelper.GetItemStyle(serie, serieData); if (itemStyle.show && itemStyle.borderWidth > 0 && !ChartHelper.IsClearColor(itemStyle.borderColor)) { UGL.DrawDoughnut(vh, serie.context.center, outsideRadius, outsideRadius + itemStyle.borderWidth, itemStyle.borderColor, Color.clear, chart.settings.cicleSmoothness); UGL.DrawDoughnut(vh, serie.context.center, insideRadius, insideRadius + itemStyle.borderWidth, itemStyle.borderColor, Color.clear, chart.settings.cicleSmoothness); } }
public static LabelStyle GetSerieEmphasisLabel(Serie serie, SerieData serieData) { if (!serie.IsPerformanceMode() && serieData.emphasisLabel != null && serieData.emphasisLabel.show) { return(serieData.emphasisLabel); } else if (serie.emphasisLabel != null && serie.emphasisLabel.show) { return(serie.emphasisLabel); } else { return(null); } }
public static ItemStyle GetItemStyleEmphasis(Serie serie, SerieData serieData) { if (!serie.IsPerformanceMode() && serieData != null && serieData.emphasisItemStyle != null && serieData.emphasisItemStyle.show) { return(serieData.emphasisItemStyle); } else if (serie.emphasisItemStyle != null && serie.emphasisItemStyle.show) { return(serie.emphasisItemStyle); } else { return(null); } }
public override Vector3 GetSerieDataLabelPosition(SerieData serieData, LabelStyle label) { switch (label.position) { case LabelStyle.Position.Bottom: var center = serieData.context.rect.center; return(new Vector3(center.x, center.y - serieData.context.rect.height / 2)); case LabelStyle.Position.Center: case LabelStyle.Position.Inside: return(serieData.context.rect.center); default: return(serieData.context.position); } }
public override Vector3 GetSerieDataLabelOffset(SerieData serieData, LabelStyle label) { var invert = label.autoOffset && SerieHelper.IsDownPoint(serie, serieData.index) && (serie.areaStyle == null || !serie.areaStyle.show); if (invert) { var offset = label.GetOffset(serie.context.insideRadius); return(new Vector3(offset.x, -offset.y, offset.z)); } else { return(label.GetOffset(serie.context.insideRadius)); } }
private void DrawBackground(VertexHelper vh, Serie serie, SerieData serieData, int index, float insideRadius, float outsideRadius) { var itemStyle = SerieHelper.GetItemStyle(serie, serieData); var backgroundColor = SerieHelper.GetItemBackgroundColor(serie, serieData, chart.theme, index, false); if (itemStyle.backgroundWidth != 0) { var centerRadius = (outsideRadius + insideRadius) / 2; var inradius = centerRadius - itemStyle.backgroundWidth / 2; var outradius = centerRadius + itemStyle.backgroundWidth / 2; UGL.DrawDoughnut(vh, serie.context.center, inradius, outradius, backgroundColor, Color.clear, chart.settings.cicleSmoothness); } else { UGL.DrawDoughnut(vh, serie.context.center, insideRadius, outsideRadius, backgroundColor, Color.clear, chart.settings.cicleSmoothness); } }
private void DrawRadarSymbol(VertexHelper vh, Serie serie, SerieData serieData, int serieIndex, bool isHighlight, List <Vector3> pointList) { if (serie.symbol.show && serie.symbol.type != SymbolType.None) { var symbolSize = isHighlight ? serie.symbol.GetSelectedSize(serieData.data, chart.theme.serie.lineSymbolSelectedSize) : serie.symbol.GetSize(serieData.data, chart.theme.serie.lineSymbolSize); var symbolColor = SerieHelper.GetItemColor(serie, serieData, chart.theme, serieIndex, isHighlight); var symbolToColor = SerieHelper.GetItemToColor(serie, serieData, chart.theme, serieIndex, isHighlight); var symbolEmptyColor = SerieHelper.GetItemBackgroundColor(serie, serieData, chart.theme, serieIndex, isHighlight, false); var symbolBorder = SerieHelper.GetSymbolBorder(serie, serieData, chart.theme, isHighlight); var borderColor = SerieHelper.GetSymbolBorderColor(serie, serieData, chart.theme, isHighlight); var cornerRadius = SerieHelper.GetSymbolCornerRadius(serie, serieData, isHighlight); foreach (var point in pointList) { chart.DrawSymbol(vh, serie.symbol.type, symbolSize, symbolBorder, point, symbolColor, symbolToColor, symbolEmptyColor, borderColor, serie.symbol.gap, cornerRadius); } } }
public static SerieData GetMaxSerieData(Serie serie, int dimension = 1, DataZoom dataZoom = null) { double max = double.MinValue; SerieData maxData = null; var dataList = serie.GetDataList(dataZoom); for (int i = 0; i < dataList.Count; i++) { var serieData = dataList[i]; if (serieData.show && serieData.data.Count > dimension) { var value = serieData.data[dimension]; if (value > max && !serie.IsIgnoreValue(value)) { max = value; maxData = serieData; } } } return(maxData); }
public static Color GetNameColor(BaseChart chart, int index, string name) { Serie destSerie = null; SerieData destSerieData = null; var series = chart.series; for (int n = 0; n < series.Count; n++) { var serie = series[n]; if (serie.placeHolder) { continue; } if (serie.useDataNameForColor) { bool found = false; for (int i = 0; i < serie.data.Count; i++) { if (name.Equals(serie.data[i].name)) { destSerie = serie; destSerieData = serie.data[i]; found = true; break; } } if (found) { break; } } if (name.Equals(serie.serieName)) { destSerie = serie; destSerieData = null; break; } } return(SerieHelper.GetItemColor(destSerie, destSerieData, chart.theme, index, false)); }
public static Color32 GetItemBackgroundColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, bool highlight, bool useDefault = true) { var color = ChartConst.clearColor32; if (highlight) { var itemStyleEmphasis = GetItemStyleEmphasis(serie, serieData); if (itemStyleEmphasis != null && !ChartHelper.IsClearColor(itemStyleEmphasis.backgroundColor)) { color = itemStyleEmphasis.backgroundColor; ChartHelper.SetColorOpacity(ref color, itemStyleEmphasis.opacity); return(color); } } var itemStyle = GetItemStyle(serie, serieData); if (!ChartHelper.IsClearColor(itemStyle.backgroundColor)) { color = itemStyle.backgroundColor; if (highlight) { color = ChartHelper.GetHighlightColor(color); } ChartHelper.SetColorOpacity(ref color, itemStyle.opacity); return(color); } else if (useDefault) { color = theme.GetColor(index); if (highlight) { color = ChartHelper.GetHighlightColor(color); } color.a = 50; return(color); } return(color); }
public static string GetFormatterContent(Serie serie, SerieData serieData, double dataValue, double dataTotal, LabelStyle serieLabel, Color color) { if (serieLabel == null) { serieLabel = SerieHelper.GetSerieLabel(serie, serieData); } var numericFormatter = serieLabel == null ? "" : serieLabel.numericFormatter; var serieName = serie.serieName; var dataName = serieData != null ? serieData.name : null; if (string.IsNullOrEmpty(serieLabel.formatter)) { var currentContent = ChartCached.NumberToStr(dataValue, numericFormatter); if (serieLabel.formatterFunction == null) { return(currentContent); } else { return(serieLabel.formatterFunction(serieData.index, dataValue, null, currentContent)); } } else { var content = serieLabel.formatter; FormatterHelper.ReplaceSerieLabelContent(ref content, numericFormatter, serie.dataCount, dataValue, dataTotal, serieName, dataName, dataName, color, serieData); if (serieLabel.formatterFunction == null) { return(content); } else { return(serieLabel.formatterFunction(serieData.index, dataValue, null, content)); } } }
public static Color32 GetItemToColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, bool highlight, bool opacity = true) { if (serie == null) { return(ChartConst.clearColor32); } ItemStyle itemStyle = null; if (highlight) { itemStyle = GetItemStyleEmphasis(serie, serieData); } if (itemStyle == null) { itemStyle = GetItemStyle(serie, serieData); } var color = itemStyle.toColor; if (ChartHelper.IsClearColor(color)) { color = ChartHelper.IsClearColor(itemStyle.color) ? theme.GetColor(index) : itemStyle.color; } if (highlight) { color = ChartHelper.GetHighlightColor(color); } if (opacity) { ChartHelper.SetColorOpacity(ref color, itemStyle.opacity); } return(color); }
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 bool CanShowLabel(Serie serie, SerieData serieData, LabelStyle label, int dimesion) { return(serie.show && serieData.context.canShowLabel && !serie.IsIgnoreValue(serieData, dimesion)); }
private static void CheckSerieDataLabel(Serie serie, SerieData serieData, int total, bool isLeft, ComponentTheme theme, ref Vector3 lastCheckPos, ref float lastX) { if (!serieData.context.canShowLabel) { serieData.SetLabelActive(false); return; } if (!serieData.show) { return; } var serieLabel = SerieHelper.GetSerieLabel(serie, serieData); var isOutside = serieLabel.position == LabelStyle.Position.Outside || serieLabel.position == LabelStyle.Position.Default; if (!serieLabel.show) { return; } if (!isOutside) { return; } var labelLine = SerieHelper.GetSerieLabelLine(serie, serieData); var fontSize = serieData.labelObject.GetHeight(); if (lastCheckPos == Vector3.zero) { lastCheckPos = serieData.context.labelPosition; } else if (serieData.context.labelPosition.x != 0) { if (lastCheckPos.y - serieData.context.labelPosition.y < fontSize) { var labelRadius = serie.context.outsideRadius + labelLine.lineLength1; var y1 = lastCheckPos.y - fontSize; var cy = serie.context.center.y; var diff = Mathf.Abs(y1 - cy); var diffX = labelRadius * labelRadius - diff * diff; diffX = diffX <= 0 ? 0 : diffX; var x1 = serie.context.center.x + Mathf.Sqrt(diffX) * (isLeft ? -1 : 1); var newPos = new Vector3(x1, y1); serieData.context.labelPosition = newPos; var angle = ChartHelper.GetAngle360(Vector2.up, newPos - serie.context.center); if (angle >= 180 && angle <= 270) { serieData.context.labelPosition = new Vector3(isLeft?(++lastX): (--lastX), y1); } else if (angle < 180 && angle >= 90) { serieData.context.labelPosition = new Vector3(isLeft?(++lastX): (--lastX), y1); } else { lastX = x1; } } else { lastX = serieData.context.labelPosition.x; } lastCheckPos = serieData.context.labelPosition; serieData.labelObject.SetPosition(SerieLabelHelper.GetRealLabelPosition(serie, serieData, serieLabel, labelLine)); } }
static void OnGet(SerieData serieData) { }
public static void Release(SerieData toRelease) { s_ListPool.Release(toRelease); }
static void OnClear(SerieData serieData) { serieData.Reset(); }