예제 #1
0
        protected void DrawLabelBackground(VertexHelper vh, Serie serie, SerieData serieData)
        {
            var serieLabel = SerieHelper.GetSerieLabel(serie, serieData);

            if (!serieLabel.show)
            {
                return;
            }
            var invert = serie.type == SerieType.Line &&
                         SerieHelper.IsDownPoint(serie, serieData.index) &&
                         !serie.areaStyle.show;
            var centerPos    = serieData.labelPosition + serieLabel.offset * (invert ? -1 : 1);
            var labelHalfWid = serieData.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);
            }
        }
예제 #2
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)
            {
                ChartDrawer.DrawBorder(vh, centerPos, serieData.GetLabelWidth(), serieData.GetLabelHeight(),
                                       serieLabel.borderWidth, serieLabel.borderColor, serieLabel.rotate);
            }
        }
예제 #3
0
        public 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.textStyle.rotate > 0)
            {
                p1 = ChartHelper.RotateRound(p1, centerPos, Vector3.forward, serieLabel.textStyle.rotate);
                p2 = ChartHelper.RotateRound(p2, centerPos, Vector3.forward, serieLabel.textStyle.rotate);
                p3 = ChartHelper.RotateRound(p3, centerPos, Vector3.forward, serieLabel.textStyle.rotate);
                p4 = ChartHelper.RotateRound(p4, centerPos, Vector3.forward, serieLabel.textStyle.rotate);
            }

            UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, serieLabel.textStyle.backgroundColor);

            if (serieLabel.border)
            {
                UGL.DrawBorder(vh, centerPos, serieData.GetLabelWidth(), serieData.GetLabelHeight(),
                               serieLabel.borderWidth, serieLabel.borderColor, serieLabel.textStyle.rotate);
            }
        }
예제 #4
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);
            }
        }