如何设置livechart的标签颜色?

How to set label color of livechart?

我有一个基于 materialdesigninxaml 框架的应用程序,我可以在其中设置浅色和深色,当设置浅色时,我可以正确看到黑色的标签文本,但是当我设置深色主题时,标签图表仍然是黑色的,所以我什么也看不到。这是我的图表:

 <lvc:CartesianChart Series="{Binding}" LegendLocation="Bottom">
       <lvc:CartesianChart.AxisY>
           <lvc:Axis Labels="{Binding AnalysisController.Labels}"/>
       </lvc:CartesianChart.AxisY>
 </lvc:CartesianChart>

我尝试按照文档的建议将其添加到我的 App.xaml 中:

<ResourceDictionary Source="pack://application:,,,/LiveCharts.Wpf;component/Themes/Colors/white.xaml" />

但是文字的颜色还是黑色

您可以像这样将轴的 Foreground 设置为另一种颜色:

<lvc:CartesianChart Series="{Binding}" LegendLocation="Bottom">
    <lvc:CartesianChart.AxisY>
        <lvc:Axis Labels="{Binding AnalysisController.Labels}"
                  Foreground="White"/>
    </lvc:CartesianChart.AxisY>
</lvc:CartesianChart>