We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Need information on multiple charts superimposed.

Thread ID:

Created:

Updated:

Platform:

Replies:

75752 Aug 7,2008 07:24 PM UTC Aug 8,2008 04:21 AM UTC WPF 1
loading
Tags: Chart
satyajit
Asked On August 7, 2008 07:24 PM UTC

I was using this code snippet to generate multiple chartseries on the same chart. have attached the jpeg file. We recently got a licensed copy of sync fusion and I can no longer do this. I have attached the image with before and after charts for the same value. Many classes are obsolete in the new version and I don't know how to generate this chart.
Thanks,
Satya

//the two params are nothing but a set of x and y values.this code was working fine with a version of syncfusion a month ago

public void adddatafromcollection(TrajectoryParentFillList pFillLst, TrajectoryPointList pointLst)
{

//chart 1 data
ChartBindingData bindingdata = new ChartBindingData();
bindingdata.BeginInit();
bindingdata.XPath = new String( new char[]{'X'});
bindingdata.YPaths = new string[] { "Y" };
bindingdata.Source = pointLst;
bindingdata.EndInit();
Binding binding = new Binding();
binding.Source = bindingdata;
BindingOperations.SetBinding(chartseries, ChartSeries.DataProperty, binding);
BindingOperations.SetBinding(chartseries2, ChartSeries.DataProperty, binding);

//chart 2 data
ChartBindingData bindingdata1 = new ChartBindingData();
bindingdata1.BeginInit();
bindingdata1.XPath = "X" ;
bindingdata1.YPaths = new string[] { "Y" };
bindingdata1.Source = pFillLst;
bindingdata1.EndInit();
Binding binding1 = new Binding();
binding1.Source = bindingdata1;
BindingOperations.SetBinding(chartSeriesPFills, ChartSeries.DataProperty, binding1);
BindingOperations.SetBinding(chartSeriesPFills2, ChartSeries.DataProperty, binding1);

chartseries.MouseHover += new MouseEventHandler(ChartSeries_MouseHover);
chartseries.MouseLeave += new MouseEventHandler(series_MouseLeave);

chartseries2.MouseHover += new MouseEventHandler(ChartSeries_MouseHover);
chartseries2.MouseLeave += new MouseEventHandler(series_MouseLeave);

chartSeriesPFills.MouseHover += new MouseEventHandler(ChartSeries_MouseHover);
chartSeriesPFills.MouseLeave += new MouseEventHandler(series_MouseLeave);

chartSeriesPFills2.MouseHover += new MouseEventHandler(ChartSeries_MouseHover);
chartSeriesPFills2.MouseLeave += new MouseEventHandler(series_MouseLeave);

chartseries.Type = ChartTypes.Scatter;
chartseries2.Type = ChartTypes.Line;
chartSeriesPFills.Type = ChartTypes.Scatter;
chartSeriesPFills2.Type = ChartTypes.Line;

//chartSeriesPFills2.Type = ChartTypes.Line;

//ChartListData datalist = new ChartListData();
//Random rand = new Random();
//int i = 0;

//datalist.Add(new ChartPoint(169, new double[] { 3100 }));
//datalist.Add(new ChartPoint(305, new double[] { 3600}));
//datalist.Add(new ChartPoint(305, new double[] { 7600}));
//chartSeriesPFills2.Data = datalist;

chartseries.Interior = this.Resources["SeriesInt"] as Brush;
//chartseries.AdornmentsInfo.SegmentLabelContent = LabelContent.YValue;
//chartseries.AdornmentsInfo.Visible = true;

chart1.Areas[0].Series.Add(chartseries);
chart1.Areas[0].Series.Add(chartseries2);
chart1.Areas[0].Series.Add(chartSeriesPFills);
chart1.Areas[0].Series.Add(chartSeriesPFills2);

chart1.Areas[0].PrimaryAxis.Interval = pointLst._XInterval;
chart1.Areas[0].SecondaryAxis.Interval = pointLst._Yinterval;
//ChartAxis cprX = chart1.Areas[0].PrimaryAxis;
//cprX.ContentPath = "X";
//cprX.PositionPath = "X";
//cprX.LabelsSource = pointLst;

//ChartAxis cprY = chart1.Areas[0].SecondaryAxis;
//cprY.ContentPath = "Y";
//cprY.PositionPath = "Y";
//cprY.LabelsSource = pointLst;
}




Image of Chart_c8e371e4.zip

Administrator [Syncfusion]
Replied On August 8, 2008 04:21 AM UTC

Hi Satya,

Sorry for the inconvenience. Recently we have revised our databinding methods for ChartSeries in order to provide the users with the easily ways to bind data.

Previously we had ChartBindingData class as a helper class to bind the data to ChartSeries. With this feature, ChartSeries can be directly bound to ObservableCollection, XML data, IList, LINQ results, CollectionViewSource and so on.

Following properties has been implemented to accomodate this feature.

DataSource - A new property has been implemented to directly bind the data from any type of source such LINQ results, ObservableCollections, CollectionViewSource, IList collections etc.

BindingPathX – A string property used to specify the path from where values should be picked for X axis.

BindingPathsY – A string[] property used to specify the path of the Y values in the source.

Sample in the following location illustrates the new DataBinding concepts of Chart WPF.

http://www.syncfusion.com/Product/uploads/ChartDataBindingIllustration_4c0dc135.zip

With regards to the issue mentioned in your attachment, IsIndexed property of the line series is set to true by default. You can overcome this by having IsIndexed property set to false exclusively. The following lines of code can be used to change the IsIndexed property of a chartseries.

C# Code:

chartseries.IsIndexed = false;

Still if you encounter this issue, kindly update us with a sample so that we can help you overcome the issue.

Thanks for your interests in Syncfusion products.

Please let us know if you have further queries.

Regards,
Athaur Rahman GS


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;