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

下面是我的代码:
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);
}
}没有用于设置曲线比例字体系列和大小的属性。有没有其他的解决方案?谢谢。
发布于 2021-10-08 06:07:42
添加以下代码即可解决此问题:
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;https://stackoverflow.com/questions/69490599
复制相似问题