SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components
Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!
Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.
I found how to change the axis tick label FontWeight in the XAML code by creating a Style, but is there a way to change the axis tick label FontWeight property in the code behind (MainWindow.xaml.cs)?
The reason I want to be able to do this is that I prefer to create the axis in code. Here is how I set up the XAxis in code:
double xDelta = 10.0; sciChart.XAxis = new NumericAxis(); sciChart.XAxis.AxisAlignment = AxisAlignment.Bottom; sciChart.XAxis.DrawMajorBands = true; sciChart.XAxis.FlipCoordinates = false; sciChart.XAxis.GrowBy = new DoubleRange( -xDelta, xDelta ); sciChart.XAxis.TextFormatting = "#0"; sciChart.XAxis.VisibleRange = new DoubleRange( m_MinX - xDelta, m_MaxX + xDelta ); sciChart.XAxis.VisibleRangeLimit = new DoubleRange( m_MinX - xDelta, m_MaxX + xDelta ); sciChart.XAxis.AxisTitle = "X-Axis";
It would be nice to be able to set the Font and FontWeight in the code as well.
Thanks for your question. Doing this in code is very similar to doing it in XAML. You should create a Style object with appropriate TargetType and add Setters for all the desired properties, then assign it to the TickLabelStyle property on an axis.
You can easily find an example of creating styles in code by googling it.
Please let us know if you need more assistance with this,