Category / Section
How to change the series color in the OLAP Chart?
1 min read
You can change the series color in the OLAP Chart by using the following code examples.
C#
public MainWindow() { InitializeComponent(); this.olapchart1.OlapDataManager = new Syncfusion.Olap.Manager.OlapDataManager("Data Source=http://bi.syncfusion.com/olap/msmdpump.dll; Initial Catalog=Adventure Works DW 2008 SE;"); this.olapchart1.OlapDataManager.SetCurrentReport(SampleReport()); this.olapchart1.Loaded += olapchart1_Loaded; } void olapchart1_Loaded(object sender, RoutedEventArgs e) { SolidColorBrush solidColorBrush = new SolidColorBrush(); solidColorBrush.Color = Color.FromArgb(255, 0, 0, 255); foreach (var series in this.olapchart1.Series) { foreach (var segment in series.Segments) { segment.Interior = solidColorBrush; } } }
VB
Public Sub New() InitializeComponent() Me.olapchart1.OlapDataManager = New Syncfusion.Olap.Manager.OlapDataManager("Data Source=http://bi.syncfusion.com/olap/msmdpump.dll; Initial Catalog=Adventure Works DW 2008 SE;") Me.olapchart1.OlapDataManager.SetCurrentReport(SampleReport()) AddHandler Me.olapchart1.Loaded, AddressOf olapchart1_Loaded End Sub Private Sub olapchart1_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs) Dim solidColorBrush As New SolidColorBrush() solidColorBrush.Color = Color.FromArgb(255, 0, 0, 255) For Each series In Me.olapchart1.Series For Each segment In series.Segments segment.Interior = solidColorBrush Next segment Next series End Sub