Jump to content
Software FX Community

When I add individual series to chart in a button click event handler, all the added series are in the same color(Blue). Is there a way to make each individual series adapt its own color automatically? Thanks very much


Ethankie

Recommended Posts

See the code blow:

private void Button_Click_1(object sender, RoutedEventArgs e)

{

 

var startDate = new DateTime(2008, 3, 7);

var seed = new Random();var isEstimated = false;

//this.chart1.Series.Clear();

//this.chart1.Refresh();var itemsSource = new List<ChartTestData>();for (int i = 1; i <= this._count; i++)

{

itemsSource.Add(new ChartTestData { Date = startDate, Price = seed.Next(50,100), IsEstimated = isEstimated });

startDate = startDate.AddDays(7);

 

isEstimated = i % 7 == 0 || i % 6 == 0;

 

}

this.chart1.Series.Add(new SeriesAttributes("Price")

{

ItemsSource = itemsSource,

Content = "Price",Gallery = Gallery.Line,

StrokeThickness = 1,

Marker = new MarkerAttributes { Visibility = Visibility.Collapsed }

});

}

 

See the picture:

 

Posted Image

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...