timlin Posted January 6, 2014 Report Share Posted January 6, 2014 I am plotting dates in the x-axis (as x-values) and doubles in the y-axis. If I have 3 double values, 9, 10, and 13, for example all plotted on the same date, they currently all plot at the 1/6/2014 date in a horizontal line. Is there a way to still use x-values for dates but have each date show up in the x-axis (the 1/6/2014 date would show up as 3 separate points)? Thanks! John Quote Link to comment Share on other sites More sharing options...
AndreG Posted January 7, 2014 Report Share Posted January 7, 2014 Hello John, Unfortunatelly this is not possible. This would be a hibrid of categorical and numerical axis. Not supported. I apologize for the inconvenience. Maybe what you are looking for is just a regular categorical axis (where the dates on the axis are just labels and not data)? Quote Link to comment Share on other sites More sharing options...
timlin Posted January 7, 2014 Author Report Share Posted January 7, 2014 Thanks for the reply. I believe you are correct and I can get the functionality I need (hopefully) with a categorical axis. It may just be something I am doing wrong with binding. I tried plotting the dates as strings instead of DateTime objects while binding. I have 2 sets of data, for example, label A with 3 values of 9, 10, and 13. Label B has 3 values of 10, 11, and 14. The values 9 and 10, 10 and 11, and 13 and 14 are taken on the same date. When I bind the data using strings, I am getting 6 date values in the x-axis instead of 2 graphs with 3 date values.Is it correct to just bind the date values as strings? Thanks a lot!John Quote Link to comment Share on other sites More sharing options...
AndreG Posted January 7, 2014 Report Share Posted January 7, 2014 Try this. You won't even need the mappings below if all you have is 1 column for strings and 2 for doubles. string data = "<?xml version=\"1.0\"?>" + "<CHARTFX>" + " <COLUMNS>" + " <COLUMN NAME=\"Date\" TYPE=\"String\"/>" + " <COLUMN NAME=\"Series1\" TYPE=\"Double\"/>" + " <COLUMN NAME=\"Series2\" TYPE=\"Double\"/>" + " </COLUMNS>" + " <ROW Date=\"1/5/2014\" Series1=\"9\" Series2=\"10\"></ROW>" + " <ROW Date=\"1/6/2014\" Series1=\"10\" Series2=\"11\"></ROW>" + " <ROW Date=\"1/7/2014\" Series1=\"13\" Series2=\"14\" ></ROW>" + "</CHARTFX>"; XmlDataProvider cfxXML = new XmlDataProvider(); cfxXML.LoadXml(data); chart1.DataSourceSettings.Fields.Add(new FieldMap("Date",FieldUsage.Label)); chart1.DataSourceSettings.Fields.Add(new FieldMap("Series1",FieldUsage.Value)); chart1.DataSourceSettings.Fields.Add(new FieldMap("Series2",FieldUsage.Value)); chart1.DataSourceSettings.DataSource = cfxXML; Quote Link to comment Share on other sites More sharing options...
timlin Posted January 7, 2014 Author Report Share Posted January 7, 2014 Thanks for the help; I need to resort my dataset to fix the series like you posted above. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.