public override void RenderAxisLabels(SKCanvas c)
        {
            if (!YAxis.IsEnabled || !YAxis.IsDrawLabelsEnabled)
            {
                return;
            }

            AxisLabelPaint.Typeface = YAxis.Typeface;
            AxisLabelPaint.TextSize = YAxis.TextSize;
            AxisLabelPaint.Color    = YAxis.TextColor;

            // calculate the factor that is needed for transforming the value to
            // pixels
            float factor = Chart.Factor;
            var   center = Chart.CenterOffsets;

            int from = YAxis.DrawBottomYLabelEntry ? 0 : 1;
            int to   = YAxis.DrawTopYLabelEntry
                    ? YAxis.EntryCount
                    : (YAxis.EntryCount - 1);

            float xOffset = YAxis.XLabelOffset;

            for (int j = from; j < to; j++)
            {
                float r = (YAxis.entries[j] - YAxis.axisMinimum) * factor;

                var pOut = ChartUtil.GetPosition(center, r, Chart.RotationAngle);

                var label = YAxis.GetFormattedLabel(j);

                c.DrawText(label, pOut.X + xOffset, pOut.Y, AxisLabelPaint);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// draws the y-labels on the specified x-position
        /// </summary>
        protected virtual void DrawYLabels(SKCanvas c, float fixedPosition, SKPoint[] positions, float offset)
        {
            int from = YAxis.DrawBottomYLabelEntry ? 0 : 1;
            int to   = YAxis.DrawTopYLabelEntry
                    ? YAxis.entryCount
                    : (YAxis.entryCount - 1);

            float xOffset = YAxis.XLabelOffset;

            // draw
            for (int i = from; i < to; i++)
            {
                c.DrawText(YAxis.GetFormattedLabel(i),
                           fixedPosition + xOffset,
                           positions[i].Y + offset,
                           AxisLabelPaint);
            }
        }
Ejemplo n.º 3
0
        protected override void DrawYLabels(SKCanvas c, float fixedPosition, SKPoint[] positions, float offset)
        {
            AxisLabelPaint.Typeface = YAxis.Typeface;
            AxisLabelPaint.TextSize = YAxis.TextSize;
            AxisLabelPaint.Color    = YAxis.TextColor;

            int from = YAxis.DrawBottomYLabelEntry ? 0 : 1;
            int to   = YAxis.DrawTopYLabelEntry
                    ? YAxis.entryCount
                    : (YAxis.entryCount - 1);

            float xOffset = YAxis.XLabelOffset;

            // draw
            for (int i = from; i < to; i++)
            {
                c.DrawText(YAxis.GetFormattedLabel(i),
                           positions[i].X,
                           fixedPosition - offset + xOffset,
                           AxisLabelPaint);
            }
        }