简体   繁体   English

Zedgraph标签消失

[英]Zedgraph labels disappears

I have made bar diagram with horizontal lines, it works fine, and a combobox where the users can change to a pie chart, with sort of work, when the user change to pie chart it works fine, but when change back from the pie chart to the bar chart, only the bars come, not the title, the x-asis tick, they axis tick nor the custom labels for the y axis. 我已经制作了带有水平线的条形图,它的工作原理很好,还有一个组合框,用户可以通过某种方式更改为饼图,当用户更改为饼图时,它可以正常工作,但是从饼图改回在条形图中,只有条形出现,而不是标题,x-asis刻度,它们的轴刻度或y轴的自定义标签。

I have search the net, and tried the following lines 我已经在网上搜索过,并尝试了以下几行

myPane.YAxis.Scale.IsVisible=true;
myPane.XAxis.Scale.IsVisible=true;
myPane.XAxis.Scale.Min = 0;
myPane.XAxis.Scale.Max = 30;
myPane.YAxis.Scale.Min = 0;
myPane.YAxis.Scale.Max = 9;

myPane.Legend.IsVisible = true;

but it only shows the bars there and nothing else. 但只显示那里的条形图,没有其他显示。 it works fine, if the bars diagram is made before, and without shift to the pie-chart 如果条形图是以前制作的,并且没有转移到饼图中,则它可以正常工作

Found a solution, finally. 终于找到了解决方案。

Making a rectangle for prooper size 为Prooper尺寸制作一个矩形

RectangleF rc=new RectangleF();

rc.X=0;
rc.Y=0; 
rc.Width=zgc.Width;
rc.Height=zgc.Height;

Make a new graph rather than a new masterpane 制作新图形而不是新主窗格

zgc.GraphPane=new GraphPane(rc,"title","x - axis","y-axis");

Link the new pane 链接新窗格

myPane=zgc.GraphPane;

That worked for me, now I get the corect size, and all values and ticks. 这对我有用,现在我得到了corect的大小以及所有值和刻度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM