当“轴是固定图表的一部分的范围时,整个图表不可见,并且轴标签重叠了

问题描述 投票:1回答:1

[enter image description here]通过使用ColorBand工具,我将坐标轴划定为图表范围,因此将单独的图表区域分配给了该轴和信号,但是当启用光标时,整个图表(参考所附图像)和轴标题均不可见彼此重叠(请参阅所附图像)。

Dictionary<int, AxisScope> list = new Dictionary<int, AxisScope>();
                    foreach (AxisScope axis in this.Chart.Axes.Custom)
                    {
                        axis.Visible = axis.Scope;
                        totalWeight += axis.Weight;
                        while (list.Keys.Contains(axis.Ordinal))
                            axis.ordinal++;
                        list.Add(axis.Ordinal, axis);
                    }
                    int ord = 0;
                    double start = 0;
                    int pos = 0;
                    int[] array = list.Keys.ToArray();
                    Array.Sort(array);
                    foreach (int i in array)
                    {
                        AxisScope scope = list[i];
                        scope.Ordinal = ord++;
                        if (scope.Scope && scope.Weight > 0)
                        {
                            if (scope.AxisColorBackground == null)
                                scope.AxisColorBackground = new ColorBand(this.Chart);

                            this.Chart.Tools.Add(scope.AxisColorBackground);
                            scope.AxisColorBackground.Axis = scope;

                            Color pen = Color.DarkRed;
                            Color back = Color.FromArgb(253, 253, 233);
                            if ((pos++ % 2) == 0)
                            {
                                pen = Color.DarkBlue;
                                back = Color.FromArgb(233, 253, 253);
                            }
                            scope.StartPosition = start;
                            start += (scope.Weight / totalWeight) * 100;
                            scope.EndPosition = start;
                            scope.AxisPen.Color = pen;
                            scope.AxisColorBackground.Pen.Color = back;
                            scope.AxisColorBackground.Brush.Color = back;
                            scope.AxisColorBackground.Brush.Transparency = 33;
                            scope.AxisColorBackground.Transparency = 33;
                            scope.AxisColorBackground.Start = double.MinValue;// scope.Minimum;
                            scope.AxisColorBackground.End = double.MaxValue;// scope.Maximum;
                            scope.AxisColorBackground.ResizeEnd = false;
                            scope.AxisColorBackground.ResizeStart = false;
                            scope.AxisColorBackground.Tag = "Axis -" + scope.Title.ToString();
                            scope.AxisColorBackground.Active = true;
                        }
                        else if (scope.Scope && scope.Weight == 0)
                        {
                            scope.Visible = false;
                        }    
                    }


  [1]: https://i.stack.imgur.com/C219j.png
c# teechart
1个回答
0
投票
[您能否提供Minimal, Reproducible Example,我可以在这里运行以立即重现您的问题吗?如果您觉得代码太长而无法在此处发布,则可以考虑压缩Visual Studio项目并将其发布到Steema's upload page
© www.soinside.com 2019 - 2024. All rights reserved.