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.runtimeCenterPos, radius, itemStyle.centerColor, smoothness);
            }
        }
 public static IconStyle GetIconStyle(Serie serie, SerieData serieData)
 {
     if (serieData.enableIconStyle)
     {
         return(serieData.iconStyle);
     }
     else
     {
         return(serie.iconStyle);
     }
 }
 public static SerieSymbol GetSerieSymbol(Serie serie, SerieData serieData)
 {
     if (!serie.IsPerformanceMode() && serieData.enableSymbol)
     {
         return(serieData.symbol);
     }
     else
     {
         return(serie.symbol);
     }
 }
        public static void UpdatePieLabelPosition(Serie serie, SerieData serieData)
        {
            if (serieData.labelObject == null)
            {
                return;
            }
            var currAngle     = serieData.runtimePieHalfAngle;
            var currRad       = currAngle * Mathf.Deg2Rad;
            var offsetRadius  = serieData.runtimePieOffsetRadius;
            var insideRadius  = serieData.runtimePieInsideRadius;
            var outsideRadius = serieData.runtimePieOutsideRadius;
            var serieLabel    = SerieHelper.GetSerieLabel(serie, serieData);

            switch (serieLabel.position)
            {
            case SerieLabel.Position.Center:
                serieData.labelPosition = serie.runtimeCenterPos;
                break;

            case SerieLabel.Position.Inside:
                var labelRadius = offsetRadius + insideRadius + (outsideRadius - insideRadius) / 2 + serieLabel.margin;
                var labelCenter = new Vector2(serie.runtimeCenterPos.x + labelRadius * Mathf.Sin(currRad),
                                              serie.runtimeCenterPos.y + labelRadius * Mathf.Cos(currRad));
                serieData.labelPosition = labelCenter;
                break;

            case SerieLabel.Position.Outside:
                if (serieLabel.lineType == SerieLabel.LineType.HorizontalLine)
                {
                    var radius1 = serie.runtimeOutsideRadius;
                    var radius3 = insideRadius + (outsideRadius - insideRadius) / 2;
                    var currSin = Mathf.Sin(currRad);
                    var currCos = Mathf.Cos(currRad);
                    var pos0    = new Vector3(serie.runtimeCenterPos.x + radius3 * currSin, serie.runtimeCenterPos.y + radius3 * currCos);
                    if (currAngle > 180)
                    {
                        currSin = Mathf.Sin((360 - currAngle) * Mathf.Deg2Rad);
                        currCos = Mathf.Cos((360 - currAngle) * Mathf.Deg2Rad);
                    }
                    var r4 = Mathf.Sqrt(radius1 * radius1 - Mathf.Pow(currCos * radius3, 2)) - currSin * radius3;
                    r4 += serieLabel.lineLength1 + serieLabel.lineWidth * 4;
                    r4 += serieData.labelObject.label.GetPreferredWidth() / 2;
                    serieData.labelPosition = pos0 + (currAngle > 180 ? Vector3.left : Vector3.right) * r4;
                }
                else
                {
                    labelRadius = serie.runtimeOutsideRadius + serieLabel.lineLength1;
                    labelCenter = new Vector2(serie.runtimeCenterPos.x + labelRadius * Mathf.Sin(currRad),
                                              serie.runtimeCenterPos.y + labelRadius * Mathf.Cos(currRad));
                    serieData.labelPosition = labelCenter;
                }
                break;
            }
        }
Beispiel #5
0
        internal static float GetSymbolBorder(Serie serie, SerieData serieData, ChartTheme theme, bool highlight, bool useLineWidth = true)
        {
            var itemStyle = GetItemStyle(serie, serieData, highlight);

            if (itemStyle != null && itemStyle.borderWidth != 0)
            {
                return(itemStyle.borderWidth);
            }
            else
            {
                return(serie.lineStyle.GetWidth(theme.serie.lineWidth));
            }
        }
Beispiel #6
0
        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);
            }
        }
Beispiel #7
0
        public static string GetNumericFormatter(Serie serie, SerieData serieData)
        {
            var itemStyle = SerieHelper.GetItemStyle(serie, serieData);

            if (!string.IsNullOrEmpty(itemStyle.numericFormatter))
            {
                return(itemStyle.numericFormatter);
            }
            else
            {
                return(string.Empty);
            }
        }
        private 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);
            }
        }
        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 && itemStyle.borderColor != Color.clear)
            {
                ChartDrawer.DrawDoughnut(vh, serie.runtimeCenterPos, outsideRadius,
                                         outsideRadius + itemStyle.borderWidth, itemStyle.borderColor,
                                         Color.clear, m_Settings.cicleSmoothness);
                ChartDrawer.DrawDoughnut(vh, serie.runtimeCenterPos, insideRadius,
                                         insideRadius + itemStyle.borderWidth, itemStyle.borderColor,
                                         Color.clear, m_Settings.cicleSmoothness);
            }
        }
        protected void DrawLabelBackground(VertexHelper vh, Serie serie, SerieData serieData)
        {
            if (serieData == null || serieData.labelObject == null)
            {
                return;
            }
            var serieLabel = SerieHelper.GetSerieLabel(serie, serieData);

            if (!serieLabel.show)
            {
                return;
            }
            var invert = serieLabel.autoOffset &&
                         serie.type == SerieType.Line &&
                         SerieHelper.IsDownPoint(serie, serieData.index) &&
                         !serie.areaStyle.show;
            var centerPos = Vector3.zero;

            if (serie.type == SerieType.Pie)
            {
                centerPos = SerieLabelHelper.GetRealLabelPosition(serieData, serieLabel);
            }
            else
            {
                centerPos = serieData.labelPosition + serieLabel.offset * (invert ? -1 : 1);
            }
            var labelHalfWid = serieData.labelObject.GetLabelWidth() / 2;
            var labelHalfHig = serieData.GetLabelHeight() / 2;
            var p1           = new Vector3(centerPos.x - labelHalfWid, centerPos.y + labelHalfHig);
            var p2           = new Vector3(centerPos.x + labelHalfWid, centerPos.y + labelHalfHig);
            var p3           = new Vector3(centerPos.x + labelHalfWid, centerPos.y - labelHalfHig);
            var p4           = new Vector3(centerPos.x - labelHalfWid, centerPos.y - labelHalfHig);

            if (serieLabel.rotate > 0)
            {
                p1 = ChartHelper.RotateRound(p1, centerPos, Vector3.forward, serieLabel.rotate);
                p2 = ChartHelper.RotateRound(p2, centerPos, Vector3.forward, serieLabel.rotate);
                p3 = ChartHelper.RotateRound(p3, centerPos, Vector3.forward, serieLabel.rotate);
                p4 = ChartHelper.RotateRound(p4, centerPos, Vector3.forward, serieLabel.rotate);
            }

            ChartDrawer.DrawPolygon(vh, p1, p2, p3, p4, serieLabel.backgroundColor);

            if (serieLabel.border)
            {
                ChartDrawer.DrawBorder(vh, centerPos, serieData.GetLabelWidth(), serieData.GetLabelHeight(),
                                       serieLabel.borderWidth, serieLabel.borderColor, serieLabel.rotate);
            }
            ChartDrawer.DrawPolygon(vh, serieData.labelPosition, 0.3f, Color.red);
        }
        protected void AddSerieLabel(Serie serie, SerieData serieData, int count = -1)
        {
            if (m_SerieLabelRoot == null)
            {
                return;
            }
            if (count == -1)
            {
                count = serie.dataCount;
            }
            var serieLabel = SerieHelper.GetSerieLabel(serie, serieData);
            var iconStyle  = SerieHelper.GetIconStyle(serie, serieData);

            if (serie.IsPerformanceMode())
            {
                return;
            }
            if (!serieLabel.show && !iconStyle.show)
            {
                return;
            }
            if (serie.animation.enable && serie.animation.HasFadeOut())
            {
                return;
            }
            var textName = ChartCached.GetSerieLabelName(s_SerieLabelObjectName, serie.index, serieData.index);
            var color    = Color.grey;

            if (serie.type == SerieType.Pie)
            {
                color = (serieLabel.position == SerieLabel.Position.Inside) ? Color.white :
                        (Color)m_Theme.GetColor(count);
            }
            else
            {
                color = !ChartHelper.IsClearColor(serieLabel.textStyle.color) ? serieLabel.textStyle.color :
                        (Color)m_Theme.GetColor(serie.index);
            }
            var labelObj = SerieLabelPool.Get(textName, m_SerieLabelRoot.transform, serieLabel, color,
                                              iconStyle.width, iconStyle.height, theme);
            var iconImage  = labelObj.transform.Find("Icon").GetComponent <Image>();
            var isAutoSize = serieLabel.backgroundWidth == 0 || serieLabel.backgroundHeight == 0;
            var item       = new ChartLabel();

            item.SetLabel(labelObj, isAutoSize, serieLabel.paddingLeftRight, serieLabel.paddingTopBottom);
            item.SetIcon(iconImage);
            item.SetIconActive(iconStyle.show);
            serieData.labelObject = item;
        }
Beispiel #12
0
        protected void DrawLabelBackground(VertexHelper vh, Serie serie, SerieData serieData)
        {
            var labelHalfWid = serieData.GetLabelWidth() / 2;
            var labelHalfHig = serieData.GetLabelHeight() / 2;
            var serieLabel   = serieData.GetSerieLabel(serie.label);
            var centerPos    = serieData.labelPosition + serieLabel.offset;
            var p1           = new Vector3(centerPos.x - labelHalfWid, centerPos.y + labelHalfHig);
            var p2           = new Vector3(centerPos.x + labelHalfWid, centerPos.y + labelHalfHig);
            var p3           = new Vector3(centerPos.x + labelHalfWid, centerPos.y - labelHalfHig);
            var p4           = new Vector3(centerPos.x - labelHalfWid, centerPos.y - labelHalfHig);

            if (serieLabel.rotate > 0)
            {
                p1 = ChartHelper.RotateRound(p1, centerPos, Vector3.forward, serieLabel.rotate);
                p2 = ChartHelper.RotateRound(p2, centerPos, Vector3.forward, serieLabel.rotate);
                p3 = ChartHelper.RotateRound(p3, centerPos, Vector3.forward, serieLabel.rotate);
                p4 = ChartHelper.RotateRound(p4, centerPos, Vector3.forward, serieLabel.rotate);
            }

            ChartDrawer.DrawPolygon(vh, p1, p2, p3, p4, serieLabel.backgroundColor);

            if (serieLabel.border)
            {
                var borderWid = serieLabel.borderWidth;
                p1 = new Vector3(centerPos.x - labelHalfWid, centerPos.y + labelHalfHig + borderWid);
                p2 = new Vector3(centerPos.x + labelHalfWid + 2 * borderWid, centerPos.y + labelHalfHig + borderWid);
                p3 = new Vector3(centerPos.x + labelHalfWid + borderWid, centerPos.y + labelHalfHig);
                p4 = new Vector3(centerPos.x + labelHalfWid + borderWid, centerPos.y - labelHalfHig - 2 * borderWid);
                var p5 = new Vector3(centerPos.x + labelHalfWid, centerPos.y - labelHalfHig - borderWid);
                var p6 = new Vector3(centerPos.x - labelHalfWid - 2 * borderWid, centerPos.y - labelHalfHig - borderWid);
                var p7 = new Vector3(centerPos.x - labelHalfWid - borderWid, centerPos.y - labelHalfHig);
                var p8 = new Vector3(centerPos.x - labelHalfWid - borderWid, centerPos.y + labelHalfHig + 2 * borderWid);
                if (serieLabel.rotate > 0)
                {
                    p1 = ChartHelper.RotateRound(p1, centerPos, Vector3.forward, serieLabel.rotate);
                    p2 = ChartHelper.RotateRound(p2, centerPos, Vector3.forward, serieLabel.rotate);
                    p3 = ChartHelper.RotateRound(p3, centerPos, Vector3.forward, serieLabel.rotate);
                    p4 = ChartHelper.RotateRound(p4, centerPos, Vector3.forward, serieLabel.rotate);
                    p5 = ChartHelper.RotateRound(p5, centerPos, Vector3.forward, serieLabel.rotate);
                    p6 = ChartHelper.RotateRound(p6, centerPos, Vector3.forward, serieLabel.rotate);
                    p7 = ChartHelper.RotateRound(p7, centerPos, Vector3.forward, serieLabel.rotate);
                    p8 = ChartHelper.RotateRound(p8, centerPos, Vector3.forward, serieLabel.rotate);
                }
                ChartDrawer.DrawLine(vh, p1, p2, borderWid, serieLabel.borderColor);
                ChartDrawer.DrawLine(vh, p3, p4, borderWid, serieLabel.borderColor);
                ChartDrawer.DrawLine(vh, p5, p6, borderWid, serieLabel.borderColor);
                ChartDrawer.DrawLine(vh, p7, p8, borderWid, serieLabel.borderColor);
            }
        }
        internal static Color GetItemToColor(Serie serie, SerieData serieData, ThemeInfo theme, int index, bool highlight)
        {
            var itemStyle = GetItemStyle(serie, serieData, highlight);

            if (highlight)
            {
                var itemStyleEmphasis = GetItemStyleEmphasis(serie, serieData);
                if (itemStyleEmphasis != null && itemStyleEmphasis.toColor != Color.clear)
                {
                    var color = itemStyleEmphasis.toColor;
                    color.a *= itemStyleEmphasis.opacity;
                    return(color);
                }
            }
            if (itemStyle == null)
            {
                itemStyle = serieData.itemStyle;
            }
            if (itemStyle.toColor != Color.clear)
            {
                var color = itemStyle.toColor;
                if (highlight)
                {
                    color *= color;
                }
                color.a *= itemStyle.opacity;
                return(color);
            }
            if (itemStyle.color != Color.clear)
            {
                var color = itemStyle.color;
                if (highlight)
                {
                    color *= color;
                }
                color.a *= itemStyle.opacity;
                return(color);
            }
            else
            {
                var color = (Color)theme.GetColor(index);
                if (highlight)
                {
                    color *= color;
                }
                color.a *= itemStyle.opacity;
                return(color);
            }
        }
Beispiel #14
0
 public static void ResetLabel(SerieData serieData, SerieLabel label, ThemeInfo themeInfo, int colorIndex)
 {
     if (serieData.labelObject == null)
     {
         return;
     }
     if (serieData.labelObject.label == null)
     {
         return;
     }
     serieData.labelObject.label.color = !ChartHelper.IsClearColor(label.color) ? label.color :
                                         (Color)themeInfo.GetColor(colorIndex);
     serieData.labelObject.label.fontSize  = label.fontSize;
     serieData.labelObject.label.fontStyle = label.fontStyle;
 }
 public static void ResetLabel(SerieData serieData, SerieLabel label, ChartTheme theme, int colorIndex)
 {
     if (serieData.labelObject == null)
     {
         return;
     }
     if (serieData.labelObject.label == null)
     {
         return;
     }
     serieData.labelObject.label.SetColor(!ChartHelper.IsClearColor(label.textStyle.color) ? label.textStyle.color :
                                          (Color)theme.GetColor(colorIndex));
     serieData.labelObject.label.SetFontSize(label.textStyle.GetFontSize(theme.common));
     serieData.labelObject.label.SetFontStyle(label.textStyle.fontStyle);
 }
Beispiel #16
0
        private void DrawRoundCap(VertexHelper vh, Serie serie, SerieData serieData, Vector3 centerPos,
                                  Color color, ref float drawStartDegree, ref float drawEndDegree)
        {
            if (serie.roundCap && serieData.runtimePieInsideRadius > 0)
            {
                var width      = (serieData.runtimePieOutsideRadius - serieData.runtimePieInsideRadius) / 2;
                var radius     = serieData.runtimePieInsideRadius + width;
                var diffDegree = Mathf.Asin(width / radius) * Mathf.Rad2Deg;
                drawStartDegree += diffDegree;
                drawEndDegree   -= diffDegree;

                ChartDrawer.DrawRoundCap(vh, centerPos, width, radius, drawStartDegree, serie.clockwise, color, false);
                ChartDrawer.DrawRoundCap(vh, centerPos, width, radius, drawEndDegree, serie.clockwise, color, true);
            }
        }
 public static ItemStyle GetItemStyleEmphasis(Serie serie, SerieData serieData)
 {
     if (serieData != null && serieData.enableEmphasis && serieData.emphasis.show)
     {
         return(serieData.emphasis.itemStyle);
     }
     else if (serie.emphasis.show)
     {
         return(serie.emphasis.itemStyle);
     }
     else
     {
         return(null);
     }
 }
Beispiel #18
0
 internal static ItemStyle GetItemStyleEmphasis(Serie serie, SerieData serieData)
 {
     if (!serie.IsPerformanceMode() && serieData != null && serieData.enableEmphasis && serieData.emphasis.show)
     {
         return(serieData.emphasis.itemStyle);
     }
     else if (serie.emphasis.show)
     {
         return(serie.emphasis.itemStyle);
     }
     else
     {
         return(null);
     }
 }
Beispiel #19
0
 /// <summary>
 /// 将一组数据添加到系列中。
 /// 如果数据只有一个,默认添加到维度Y中。
 /// </summary>
 /// <param name="valueList"></param>
 /// <param name="dataName"></param>
 /// <param name="maxDataNumber"></param>
 public void AddData(List <float> valueList, string dataName = null, int maxDataNumber = 0)
 {
     if (valueList == null || valueList.Count == 0)
     {
         return;
     }
     if (valueList.Count == 1)
     {
         AddYData(valueList[0], dataName, maxDataNumber);
     }
     else if (valueList.Count == 2)
     {
         AddXYData(valueList[0], valueList[1], dataName, maxDataNumber);
     }
     else
     {
         if (maxDataNumber > 0)
         {
             while (m_XData.Count > maxDataNumber)
             {
                 m_XData.RemoveAt(0);
             }
             while (m_YData.Count > maxDataNumber)
             {
                 m_YData.RemoveAt(0);
             }
             while (m_Data.Count > maxDataNumber)
             {
                 m_Data.RemoveAt(0);
             }
         }
         var serieData = new SerieData();
         serieData.name = dataName;
         for (int i = 0; i < valueList.Count; i++)
         {
             if (i == 0)
             {
                 m_XData.Add(valueList[i]);
             }
             else if (i == 1)
             {
                 m_YData.Add(valueList[i]);
             }
             serieData.data.Add(valueList[i]);
         }
         m_Data.Add(serieData);
     }
 }
Beispiel #20
0
 private void DrawRadarSymbol(VertexHelper vh, Serie serie, SerieData serieData, int serieIndex, bool isHighlight,
                              List <Vector3> pointList)
 {
     if (serie.symbol.type != SerieSymbolType.None)
     {
         var symbolSize    = (isHighlight ? serie.symbol.selectedSize : serie.symbol.size);
         var symbolColor   = SerieHelper.GetItemColor(serie, serieData, m_ThemeInfo, serieIndex, isHighlight);
         var symbolToColor = SerieHelper.GetItemToColor(serie, serieData, m_ThemeInfo, serieIndex, isHighlight);
         var symbolBorder  = SerieHelper.GetSymbolBorder(serie, serieData, isHighlight);
         foreach (var point in pointList)
         {
             DrawSymbol(vh, serie.symbol.type, symbolSize, symbolBorder, point, symbolColor,
                        symbolToColor, serie.symbol.gap);
         }
     }
 }
Beispiel #21
0
        private float GetAngleDiff(SerieData nextData, SerieData serieData, float angle)
        {
            var nextAngle = nextData.runtimeAngle;
            var lastAngle = serieData.runtimeAngle;
            var diff      = 0f;

            if (nextAngle > 270 && lastAngle < 90)
            {
                diff = 360 - nextAngle + lastAngle;
            }
            else
            {
                diff = nextAngle - lastAngle;
            }
            return(Mathf.Abs(diff));
        }
Beispiel #22
0
        internal static Color32 GetItemToColor(Serie serie, SerieData serieData, ChartTheme theme, int index, bool highlight)
        {
            if (highlight)
            {
                var itemStyleEmphasis = GetItemStyleEmphasis(serie, serieData);
                if (itemStyleEmphasis != null && !ChartHelper.IsClearColor(itemStyleEmphasis.toColor))
                {
                    return(itemStyleEmphasis.GetColor());
                }
            }
            var itemStyle = GetItemStyle(serie, serieData, highlight);

            if (itemStyle == null)
            {
                itemStyle = serieData.itemStyle;
            }
            if (!ChartHelper.IsClearColor(itemStyle.toColor))
            {
                var color = itemStyle.toColor;
                if (highlight)
                {
                    color = ChartHelper.GetHighlightColor(color);
                }
                ChartHelper.SetColorOpacity(ref color, itemStyle.opacity);
                return(color);
            }
            if (!ChartHelper.IsClearColor(itemStyle.color))
            {
                var color = itemStyle.color;
                if (highlight)
                {
                    color = ChartHelper.GetHighlightColor(color);
                }
                ChartHelper.SetColorOpacity(ref color, itemStyle.opacity);
                return(color);
            }
            else
            {
                var color = theme.GetColor(index);
                if (highlight)
                {
                    color = ChartHelper.GetHighlightColor(color);
                }
                ChartHelper.SetColorOpacity(ref color, itemStyle.opacity);
                return(color);
            }
        }
Beispiel #23
0
        internal static float GetSymbolBorder(Serie serie, SerieData serieData, bool highlight, bool useLineWidth = true)
        {
            var itemStyle = GetItemStyle(serie, serieData, highlight);

            if (itemStyle != null && itemStyle.borderWidth != 0)
            {
                return(itemStyle.borderWidth);
            }
            else if (serie.lineStyle.width != 0 && useLineWidth)
            {
                return(serie.lineStyle.width);
            }
            else
            {
                return(0);
            }
        }
        public static float GetSymbolBorder(Serie serie, SerieData serieData, bool highlight)
        {
            var itemStyle = GetItemStyle(serie, serieData, highlight);

            if (itemStyle != null && itemStyle.borderWidth != 0)
            {
                return(itemStyle.borderWidth);
            }
            else if (serie.lineStyle.width != 0)
            {
                return(serie.lineStyle.width);
            }
            else
            {
                return(1);
            }
        }
        private static void CheckSerieDataLabel(Serie serie, SerieData serieData, bool isLeft, ComponentTheme theme,
                                                ref Vector3 lastCheckPos)
        {
            if (!serieData.canShowLabel)
            {
                serieData.SetLabelActive(false);
                return;
            }
            if (!serieData.show)
            {
                return;
            }
            var serieLabel = SerieHelper.GetSerieLabel(serie, serieData);
            var fontSize   = serieLabel.textStyle.GetFontSize(theme);

            if (!serieLabel.show)
            {
                return;
            }
            if (serieLabel.position != SerieLabel.Position.Outside)
            {
                return;
            }
            if (lastCheckPos == Vector3.zero)
            {
                lastCheckPos = serieData.labelPosition;
            }
            else if (serieData.labelPosition.x != 0)
            {
                if (lastCheckPos.y - serieData.labelPosition.y < fontSize)
                {
                    var labelRadius = serie.runtimeOutsideRadius + serieLabel.lineLength1;
                    var y1          = lastCheckPos.y - fontSize;
                    var cy          = serie.runtimeCenterPos.y;
                    var diff        = Mathf.Abs(y1 - cy);
                    var diffX       = labelRadius * labelRadius - diff * diff;
                    diffX = diffX <= 0 ? 0 : diffX;
                    var x1 = serie.runtimeCenterPos.x + Mathf.Sqrt(diffX) * (isLeft ? -1 : 1);
                    serieData.labelPosition = new Vector3(x1, y1);
                }
                lastCheckPos = serieData.labelPosition;
                serieData.labelObject.SetPosition(SerieLabelHelper.GetRealLabelPosition(serieData, serieLabel));
            }
        }
Beispiel #26
0
        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, m_ThemeInfo, index, false);

            if (itemStyle.backgroundWidth != 0)
            {
                var centerRadius = (outsideRadius + insideRadius) / 2;
                var inradius     = centerRadius - itemStyle.backgroundWidth / 2;
                var outradius    = centerRadius + itemStyle.backgroundWidth / 2;
                ChartDrawer.DrawDoughnut(vh, serie.runtimeCenterPos, inradius,
                                         outradius, backgroundColor, Color.clear, m_Settings.cicleSmoothness);
            }
            else
            {
                ChartDrawer.DrawDoughnut(vh, serie.runtimeCenterPos, insideRadius,
                                         outsideRadius, backgroundColor, Color.clear, m_Settings.cicleSmoothness);
            }
        }
Beispiel #27
0
 private void DrawRadarSymbol(VertexHelper vh, Serie serie, SerieData serieData, int serieIndex, bool isHighlight,
                              List <Vector3> pointList)
 {
     if (serie.symbol.show && serie.symbol.type != SerieSymbolType.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 symbolBorder  = SerieHelper.GetSymbolBorder(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, serie.symbol.gap, cornerRadius);
         }
     }
 }
Beispiel #28
0
        private bool IsHighlight(Radar radar, Serie serie, SerieData serieData, int dataIndex, int dimension)
        {
            if (serie.highlighted || serieData.highlighted)
            {
                return(true);
            }
            if (!chart.tooltip.show)
            {
                return(false);
            }
            var selectedSerieIndex = chart.tooltip.runtimeDataIndex[0];

            if (selectedSerieIndex < 0)
            {
                return(false);
            }
            if (chart.series.GetSerie(selectedSerieIndex).radarIndex != serie.radarIndex)
            {
                return(false);
            }
            switch (serie.radarType)
            {
            case RadarType.Multiple:
                if (radar.isAxisTooltip)
                {
                    var selectedDimension = chart.tooltip.runtimeDataIndex[2];
                    return(selectedDimension == dimension);
                }
                else if (chart.tooltip.runtimeDataIndex.Count >= 2)
                {
                    return(chart.tooltip.runtimeDataIndex[0] == serie.index && chart.tooltip.runtimeDataIndex[1] == dataIndex);
                }
                else
                {
                    return(false);
                }

            case RadarType.Single:
                return(chart.tooltip.runtimeDataIndex[1] == dataIndex);
            }
            return(false);
        }
Beispiel #29
0
        private Vector3 GetPolarPos(SerieData serieData, float min, float max, float polarRadius)
        {
            var angle = 0f;

            if (!m_AngleAxis.clockwise)
            {
                angle = m_AngleAxis.runtimeStartAngle - serieData.GetData(1);
            }
            else
            {
                angle = m_AngleAxis.runtimeStartAngle + serieData.GetData(1);
            }
            angle = (angle + 360) % 360;
            var value  = serieData.GetData(0);
            var radius = (value - min) / (max - min) * polarRadius;

            serieData.runtimeAngle    = angle;
            serieData.runtimePosition = ChartHelper.GetPos(m_Polar.runtimeCenterPos, radius, angle, true);
            return(serieData.runtimePosition);
        }
Beispiel #30
0
 internal static Vector3 GetRealLabelPosition(SerieData serieData, SerieLabel label)
 {
     if (label.position == SerieLabel.Position.Outside && label.lineType != SerieLabel.LineType.HorizontalLine)
     {
         var currAngle = serieData.runtimePieHalfAngle;
         var offset    = label.lineLength2 + serieData.labelObject.GetLabelWidth() / 2;
         if (currAngle > 180)
         {
             return(serieData.labelPosition + new Vector3(-offset, 0, 0));
         }
         else
         {
             return(serieData.labelPosition + new Vector3(offset, 0, 0));
         }
     }
     else
     {
         return(serieData.labelPosition);
     }
 }