Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
Overlap column series
Hi all,
I would build a chart with two AreaSeries and some multiple overlap ColumnSeries.
In order to receive a continuous representation of my data, I convert X-values to DateTime elements (a sort of "ScatterAreaSeries").
So, my DataModel is:
public class DataPoint
public double X { get; set; }
public double Y { get; set; }
public DateTime DateTime_X
DateTime date = DateTime.Today.AddDays(X);
return date;
AreaSeries are ok but I'm not able to plot multiple column series that use the same x-values and different y-values.
Datasource is an array list like this:
List<DataPoint>[ ] data;
so I have
x = 5010 Y= 1,18
x = 5660 Y= 0,3
X = 12800 Y = 0,2
x = 5010 Y= 0,4
x = 5660 Y= 0.5
X = 12800 Y = 1,4
NumericYAxis is set on XAML file. The follow method in code-behind doesn't work. 
private void AddOverlapColumnSeries(List<DataPoint>[] data)
for (int i = 0; i < data.Lenght; i++)
var categoryDateTimeXAxis = new CategoryDateTimeXAxis();
categoryDateTimeXAxis.ItemsSource = data[i];
categoryDateTimeXAxis.DateTimeMemberPath = "DateTime_X";
var series = new ColumnSeries
ValueMemberPath = "Y",
ItemsSource = data[i],
XAxis = categoryDateTimeXAxis,
YAxis = numericYAxis
To have an idea of the chart I would build, please see the attached file.
Could be it build with Infragistics? What wrong with my code? 
Thanks in advance.
  • 28750
    Offline posted

    Hello John,

    From the screenshot that you have provided and the code that you have provided, I am a little unsure exactly of the visualization that you are looking to achieve with the Infragistics XamDataChart in Xamarin.Forms.

    Looking at your screenshot, I imagine the Grey and Orange areas are your two AreaSeries instances, but then it almost looks like you are looking to have a sort of "stacked" column series at occasional intervals in your data?

    From your code, it looks like you are trying to use a separate CategoryDateTimeXAxis per ColumnSeries as well, which I wouldn't really recommend. Is there a particular reason you are unable to use the one that you are using for your two AreaSeries in this case? I don't really see a reason why the CategoryDateTimeXAxis shouldn't let you plot ColumnSeries with the same X-Values but different Y's, because as long as the X-values are the same, I would expect that they should show up, and the NumericYAxis will interpret the ValueMemberPath accordingly. For example, if you placed a numeric property on the same data item that you are using for your AreaSeries elements, I would imagine you could just use that as a ValueMemberPath for your ColumnSeries and fill it out with double.NaN if you don't want a column plotted or use numeric values if you do.

    It is also worth mentioning that if you use multiple CategoryDateTimeXAxes, you may wind up with a skewed view unless you set the MinimumValue and MaximumValue properties to consistent values.

    One issue that you will likely have in this case is the fact that the ColumnSeries was really only designed to be used with the CategoryXAxis, and not the CategoryDateTimeXAxis. The width of the columns in a ColumnSeries really depends on how many columns will actually be plotted, and as such, if you only have a few, the columns might be very large. If they happen close to each other, they also may overlap in an undesired way. You can read further about this at the WPF thread (the XamDataChart works the same in WPF and Xamarin.Forms), here:

    It is also certainly possible that I am not really understanding your requirement very well in this case. If this is the case, would it be possible for you to perhaps attach a sample isolated project that may demonstrate where you are at with this issue? Again, though, using the CategoryDateTimeXAxis with the ColumnSeries in the XamDataChart is not really recommended, and so achieving a visualization like the one you have provided may prove rather difficult.

    Please let me know if you have any other questions or concerns on this matter.

    Associate Developer

Reply Children