private void CreateTickInfos(double[] ticks, out LinearTickPosition[] tickInfos, out TickFormattedText[] tickLabels, out GridLinePosition[] lines)
        {
            var tickInfoList  = new List <LinearTickPosition>();
            var tickLabelList = new List <TickFormattedText>();
            var gridLines     = new List <GridLinePosition>();

            if (ticks != null && ticks.Length > 0)
            {
                foreach (var tick in ticks)
                {
                    var t = new LinearTickPosition()
                    {
                        Value    = tick,
                        Position = axis.GetPositionByValue(tick),
                        Length   = LinearAxisModel.MajorTickLength,
                    };
                    tickInfoList.Add(t);
                    var text = new TickFormattedText()
                    {
                        Position = t.Position,
                        Text     = GetTickLabelFormator().GetFormattedText(AxisModel.DataConverter != null ? AxisModel.DataConverter.ToDataValue(tick) : tick),
                    };
                    tickLabelList.Add(text);
                    gridLines.Add(new GridLinePosition(t.Position, true));
                }
            }
            tickInfos  = tickInfoList.ToArray();
            tickLabels = tickLabelList.ToArray();
            lines      = gridLines.ToArray();
        }
Esempio n. 2
0
        private TickFormattedText[] CreateTickLabels(LinearAxisGrapScale axis, double[] ticks)
        {
            var ret = new List <TickFormattedText>();

            GetTickLabelFormator().InitTicks(ticks);

            if (ticks != null && ticks.Length > 0)
            {
                foreach (var tick in ticks)
                {
                    var text = new TickFormattedText()
                    {
                        Position = axis.GetPositionByValue(tick),
                        Text     = GetTickLabelFormator().GetFormattedText(AxisModel.DataConverter != null ? AxisModel.DataConverter.ToDataValue(tick) : tick),
                    };
                    ret.Add(text);
                }
            }
            return(ret.ToArray());
        }
        private TickFormattedText[] CreateLogarithmicTickLabels(LogarithmicTick[] ticks)
        {
            var ret = new List <TickFormattedText>();

            if (ticks != null && ticks.Length > 0)
            {
                foreach (var tick in ticks)
                {
                    if (tick.LabelVisible)
                    {
                        var text = new TickFormattedText()
                        {
                            Position = axis.GetPositionByValue(tick.Value.Value),
                            Text     = GetLogarithmicTickLabelFormator().GetFormattedText((AxisModel.DataConverter != null ? AxisModel.DataConverter.ToDataValue(tick.Value.Value) : tick.Value.Value)),
                        };

                        ret.Add(text);
                    }
                }
            }
            return(ret.ToArray());
        }
Esempio n. 4
0
        private void CreateTickTexts(out TickFormattedText[] texts, out LinearTickPosition[] ticks, out GridLinePosition[] lines)
        {
            var checkPreTicks  = tickCalculator.CreateTicks(new Range <double>(preAxis.Minimum, preAxis.Maximum));
            var checkPostTicks = tickCalculator.CreateTicks(new Range <double>(postAxis.Minimum, postAxis.Maximum));

            var tickTexts = new List <TickFormattedText>();
            var tickPoses = new List <LinearTickPosition>();
            var gridLines = new List <GridLinePosition>();

            if (checkPreTicks != null && checkPreTicks.Length > 0)
            {
                checkPreTicks.ToList().ForEach((tick) =>
                {
                    if (SweepLinearXAxis.PostPartValid == false || SweepLinearXAxis.InPrePartRange(tick))
                    {
                        var text = new TickFormattedText()
                        {
                            Position = preAxis.GetPositionByValue(tick),
                            Text     = GetTickLabelFormator().GetFormattedText(AxisModel.DataConverter != null ? AxisModel.DataConverter.ToDataValue(tick) : tick),
                        };
                        tickTexts.Add(text);
                        var t = new LinearTickPosition()
                        {
                            Value    = tick,
                            Position = text.Position,
                            Length   = SweepLinearAxisModel.MajorTickLength,
                        };
                        tickPoses.Add(t);
                        gridLines.Add(new GridLinePosition(text.Position, true));
                    }
                });
            }

            if (SweepLinearXAxis.PostPartValid && checkPostTicks != null && checkPostTicks.Length > 0)
            {
                checkPostTicks.ToList().ForEach((tick) =>
                {
                    if (SweepLinearXAxis.InPostPartRange(tick))
                    {
                        var text = new TickFormattedText()
                        {
                            Position = postAxis.GetPositionByValue(tick),
                            Text     = GetTickLabelFormator().GetFormattedText(AxisModel.DataConverter != null ? AxisModel.DataConverter.ToDataValue(tick) : tick),
                        };
                        tickTexts.Add(text);
                        var t = new LinearTickPosition()
                        {
                            Value    = tick,
                            Position = text.Position,
                            Length   = SweepLinearAxisModel.MajorTickLength,
                        };
                        tickPoses.Add(t);
                        gridLines.Add(new GridLinePosition(text.Position, true));
                    }
                });
            }

            texts = tickTexts.ToArray();
            ticks = tickPoses.ToArray();
            lines = gridLines.ToArray();
        }