c# - 如何调整 Syncfusion 图表的水平线注释的文本颜色?
问题描述
我在我的 Syncfusion 图表上实现了一些 HorizontalLineAnnotation 元素,它工作正常。但是,我找不到控制文本大小和颜色的注释的属性,以及注释标签的属性。
这些似乎都默认呈现蓝色,我在 XAML 或 C# 中没有任何选项来更改这些属性。我看到这些属性可用于其他类型的注释,但对于 HorizontalLineAnnotation 则没有。对我所缺少的有任何帮助吗?
谢谢。
XAML 代码:
<chart:HorizontalLineAnnotation Y1="48.92" ShowAxisLabel="True" Text="Yesterday's Close" StrokeColor="yellow" FillColor="red" />
C# 代码
HorizontalLineAnnotation horizontalLineAnnotation = new HorizontalLineAnnotation()
{
Y1 = 49.92,
ShowAxisLabel = true,
Text = "Today's Open"
};
chart.ChartAnnotations.Add(horizontalLineAnnotation);
解决方案
谢谢!使用您提供的信息,我使用了以下代码并且能够实现我的目标。
HorizontalLineAnnotation horizontalLineAnnotation = new HorizontalLineAnnotation()
{
Y1 = (double)quoteData.previousClose,
ShowAxisLabel = true,
Text = "Yesterday's Close",
StrokeColor = Color.FromHex("#55daec0e"),
};
horizontalLineAnnotation.LabelStyle.TextColor = Color.FromHex("#55daec0e");
myChart.ChartAnnotations.Add(horizontalLineAnnotation);
推荐阅读
- python - 重新连接到服务器 python
- amazon-web-services - 在浏览器中显示 mov 类型的预签名 s3 url
- linux - 如何使用 sed 用文件中的变量替换字符串?
- javascript - 如何在本机反应中将“任何”类型分配给领域模式中的对象属性?
- angular - Angular10 OWL 日期时间预设一个日期和时间
- java - Java gui - JLabel 位置
- flutter - 使用 getX 注销时对空值使用空值检查运算符
- mysql - 一次更新 4000 万个 mysql 单元
- python - 如何从字符串中排除单词
- c# - Resharper C#,如果测试失败则触发一个动作