Esempio n. 1
0
        private void RenderLabels(GaugeGraphics g)
        {
            if (!LabelStyle.Visible)
            {
                return;
            }
            double         interval         = GetInterval(IntervalTypes.Labels);
            float          offsetLabelPos   = GetOffsetLabelPos(LabelStyle.Placement, LabelStyle.DistanceFromScale, GetRadius());
            double         minimumLog       = base.MinimumLog;
            double         intervalOffset   = GetIntervalOffset(IntervalTypes.Labels);
            Color          textColor        = LabelStyle.TextColor;
            CustomTickMark endLabelTickMark = GetEndLabelTickMark();

            if (LabelStyle.ShowEndLabels && intervalOffset > 0.0)
            {
                textColor = GetRangeLabelsColor(minimumLog, LabelStyle.TextColor);
                DrawLabel(labelStr: (Common.GaugeContainer.FormatNumberHandler == null) ? string.Format(CultureInfo.CurrentCulture, LabelStyle.GetFormatStr(), minimumLog * base.Multiplier) : Common.GaugeContainer.FormatNumberHandler(Common.GaugeContainer, minimumLog * base.Multiplier, LabelStyle.FormatString), placement: LabelStyle.Placement, position: minimumLog, labelPos: offsetLabelPos, rotateLabelAngle: LabelStyle.FontAngle, font: LabelStyle.Font, color: textColor, rotateLabels: LabelStyle.RotateLabels, allowUpsideDown: LabelStyle.AllowUpsideDown, fontUnit: LabelStyle.FontUnit);
                if (endLabelTickMark != null)
                {
                    DrawTickMark(g, endLabelTickMark, minimumLog, GetTickMarkOffset(endLabelTickMark));
                }
            }
            minimumLog += intervalOffset;
            double num = 0.0;

            while (minimumLog <= base.Maximum)
            {
                bool flag = true;
                foreach (CustomLabel customLabel in base.CustomLabels)
                {
                    if (Math.Abs(customLabel.Value - minimumLog) < 1E-07 && customLabel.Placement == LabelStyle.Placement && Math.Abs(customLabel.DistanceFromScale - LabelStyle.DistanceFromScale) < 1f)
                    {
                        flag = false;
                    }
                }
                if (!LabelStyle.ShowEndLabels && (minimumLog == base.MinimumLog || minimumLog == base.Maximum))
                {
                    flag = false;
                }
                if (base.SweepPosition > 359f && minimumLog == base.MinimumLog)
                {
                    flag = false;
                }
                if (flag)
                {
                    textColor = GetRangeLabelsColor(minimumLog, LabelStyle.TextColor);
                    DrawLabel(labelStr: (Common.GaugeContainer.FormatNumberHandler == null) ? string.Format(CultureInfo.CurrentCulture, LabelStyle.GetFormatStr(), minimumLog * base.Multiplier) : Common.GaugeContainer.FormatNumberHandler(Common.GaugeContainer, minimumLog * base.Multiplier, LabelStyle.FormatString), placement: LabelStyle.Placement, position: minimumLog, labelPos: offsetLabelPos, rotateLabelAngle: LabelStyle.FontAngle, font: LabelStyle.Font, color: textColor, rotateLabels: LabelStyle.RotateLabels, allowUpsideDown: LabelStyle.AllowUpsideDown, fontUnit: LabelStyle.FontUnit);
                }
                num        = minimumLog;
                minimumLog = GetNextPosition(minimumLog, interval, forceLinear: false);
            }
            if (LabelStyle.ShowEndLabels && num < base.Maximum)
            {
                minimumLog = base.Maximum;
                textColor  = GetRangeLabelsColor(minimumLog, LabelStyle.TextColor);
                DrawLabel(labelStr: (Common.GaugeContainer.FormatNumberHandler == null) ? string.Format(CultureInfo.CurrentCulture, LabelStyle.GetFormatStr(), minimumLog * base.Multiplier) : Common.GaugeContainer.FormatNumberHandler(Common.GaugeContainer, minimumLog * base.Multiplier, LabelStyle.FormatString), placement: LabelStyle.Placement, position: minimumLog, labelPos: offsetLabelPos, rotateLabelAngle: LabelStyle.FontAngle, font: LabelStyle.Font, color: textColor, rotateLabels: LabelStyle.RotateLabels, allowUpsideDown: LabelStyle.AllowUpsideDown, fontUnit: LabelStyle.FontUnit);
                if (endLabelTickMark != null)
                {
                    DrawTickMark(g, endLabelTickMark, minimumLog, GetTickMarkOffset(endLabelTickMark));
                }
            }
        }