首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在Zedgraph中设置其他yaxis的字体和大小?

如何在Zedgraph中设置其他yaxis的字体和大小?
EN

Stack Overflow用户
提问于 2021-10-08 04:42:54
回答 1查看 18关注 0票数 0

我知道如何将字体系列和大小设置为main x yaxis和yaxis。但是,当yaxis索引为y2和y7时,我尝试了许多方法来处理其他yaxis。如图所示,DD-Price是yaxisindex = y2的yaxis,PD-Price是yaxisindex = y7的yaxis。

下面是我的代码:

代码语言:javascript
复制
        if (plotValue.Keys.Contains("DD_CurrentPrice"))
        {
            y2 = graphArea.AddYAxis("DD - Price");
            curve = new LineItem("DD - Current Price", null, plotValue["DD_CurrentPrice"], Color.FromArgb(255, 198, 001), SymbolType.None) { YAxisIndex = y2 };
            curve.Label.FontSpec = new FontSpec("Cambria", 10.0f, Color.Black, false, false, false);
            graphArea.CurveList.Add(curve);
        }

        if (plotValue.Keys.Contains("PD_MarkdownPrice") || plotValue.Keys.Contains("PD_CurrentPrice"))
        {
            y7 = graphArea.AddYAxis("PD - Price");
            if (plotValue.Keys.Contains("PD_MarkdownPrice"))
            {
                curve = new LineItem("PD - Markdown Price", null, plotValue["PD_MarkdownPrice"], Color.FromArgb(045, 186, 030), SymbolType.None) { YAxisIndex = y7 };
                curve.Label.FontSpec = new FontSpec("Cambria", 10.0f, Color.Black, false, false, false);
                graphArea.CurveList.Add(curve);
            }
            if (plotValue.Keys.Contains("PD_CurrentPrice"))
            {
                curve = new LineItem("PD - Current Price", null, plotValue["PD_CurrentPrice"], Color.FromArgb(011, 138, 000), SymbolType.None) { YAxisIndex = y7 };
                curve.Label.FontSpec = new FontSpec("Cambria", 10.0f, Color.Black, false, false, false);
                graphArea.CurveList.Add(curve);
            }

        }

没有用于设置曲线比例字体系列和大小的属性。有没有其他的解决方案?谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-10-08 06:07:42

添加以下代码即可解决此问题:

代码语言:javascript
复制
            Axis axis = graphArea.CurveList[y2].GetYAxis(graphArea);
            axis.Scale.FontSpec.Family = "Cambria";
            axis.Scale.FontSpec.Size = fontSize;
            axis.Title.FontSpec.Family = "Cambria";
            axis.Title.FontSpec.Size = fontSize;
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69490599

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档