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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

StackingColumnSeries with a DateTimeAxis?

Thread ID:

Created:

Updated:

Platform:

Replies:

118476 Mar 11,2015 11:20 AM UTC Mar 17,2015 12:03 PM UTC Xamarin.Android 5
loading
Tags: SfChart
Joost Platenburg
Asked On March 11, 2015 11:20 AM UTC

LS,

I'm trying to create a StackingColumn chart with a DateTimeAxis as PrimaryAxis. I can't get it to work. 

With a CategoryAxis (and ChartDataPoint(string, double)) it works partially. The value on the axis are all 0 iso the string value I put in the chartdatapoint, but it shows the StackingColumn. When I use the DateTimeAxis the values on the Axis are shown correctly but not stacked. The Xaml code I use looks like this:
<chart:SfChart.PrimaryAxis>
      <chart:DateTimeAxis IntervalType="Minutes" ShowMajorGridLines="True">
                           <chart:DateTimeAxis.MajorGridLineStyle>
            <chart:ChartLineStyle StrokeWidth="1" StrokeColor="#7EDBDBDB" />
          </chart:DateTimeAxis.MajorGridLineStyle>
          <chart:DateTimeAxis.Title>
            <chart:ChartAxisTitle Text="Tijd" TextColor="{x:Static local:ColorResources.AccentColor}" />
          </chart:DateTimeAxis.Title>
          <chart:DateTimeAxis.LabelStyle>
            <chart:ChartAxisLabelStyle LabelFormat="mm" TextColor="{x:Static local:ColorResources.AccentColor}" />
          </chart:DateTimeAxis.LabelStyle>
        </chart:DateTimeAxis>
<!---
  <chart:CategoryAxis>
<chart:CategoryAxis.Title> 
<chart:ChartAxisTitle Text="Tijd" TextColor="{x:Static local:ColorResources.AccentColor}" />
</chart:CategoryAxis.Title>

          <chart:CategoryAxis.LabelStyle>
            <chart:ChartAxisLabelStyle TextColor="{x:Static local:ColorResources.AccentColor}" />
          </chart:CategoryAxis.LabelStyle>
</chart:CategoryAxis>
-->
</chart:SfChart.PrimaryAxis>
<chart:SfChart.SecondaryAxis>
<chart:NumericalAxis>
<chart:NumericalAxis.Title>
<chart:ChartAxisTitle Text="Aantal" TextColor="{x:Static local:ColorResources.AccentColor}" />
</chart:NumericalAxis.Title>
<chart:NumericalAxis.LabelStyle>
           <chart:ChartAxisLabelStyle TextColor="{x:Static local:ColorResources.AccentColor}" />
          </chart:NumericalAxis.LabelStyle>
  </chart:NumericalAxis>
</chart:SfChart.SecondaryAxis>
<chart:SfChart.Series>
      <chart:StackingColumnSeries Label = "Goed" ItemsSource = "{Binding AantalGoed}" Color = "Green" />  
    <chart:StackingColumnSeries Label="OK" ItemsSource="{Binding AantalOk}" Color="Yellow" />           
      <chart:StackingColumnSeries Label = "Fout" ItemsSource = "{Binding AantalFout}" Color = "Red" />
    </chart:SfChart.Series>

The code in the view model is as follows:
if (App.CurrentData.Samples.Count > 0) {
DateTime dt = App.CurrentData.Samples [0].DatumTijd;
int count = 0;
foreach (var sample in App.CurrentData.Samples) {
count += 1;
if (count < 15) {
double dAantalGoed = 0;
double dAantalOk = 0;
double dAantalFout = 0;

foreach (var type in sample.Messages) {
dAantalGoed += type.AantalGoed; 
dAantalOk += type.AantalOK; 
dAantalFout += type.AantalFout; 
};

_AantalGoed.Add (new ChartDataPoint (sample.DatumTijd, dAantalGoed));
_AantalOk.Add (new ChartDataPoint (sample.DatumTijd, dAantalOk));
_AantalFout.Add (new ChartDataPoint (sample.DatumTijd, dAantalFout));
}

if (dt.CompareTo (sample.DatumTijd) < 0)
dt = sample.DatumTijd;
}

LastSample = string.Format ("{0}:{1}", dt.ToString("HH"), dt.ToString("mm"));
}

Any help is appreciated.
Regards Joost platenburg


Magesh Kumar Krishnan [Syncfusion]
Replied On March 12, 2015 11:57 AM UTC

Hi Joost,

Thanks for using Syncfusion products.

We have analyzed the reported issue, and this issue is not reproduced in our latest release. We have prepared a sample for your reference. Please find the sample from following link.

Sample: http://www.syncfusion.com/downloads/support/directtrac/118476/ChartSample-1240978661.zip

Note: We request you to download the latest version of Syncfusion Xamarin Studio from the following link.

https://www.syncfusion.com/forums/118366/essential-studio-2014-volume-4-service-pack-2-release-v12-4-0-34-available-for-download

Please let know if you require further assistance on this.

Thanks,
Magesh Kumar K


Joost Platenburg
Replied On March 13, 2015 02:47 PM UTC

Hello Magesh,

I'm sorry to say that I can't get the StackingColumn chart to work. The sample you send me works perfect but my own app doesn't. I am using the version you linked me to in the reply but I can only assume that my app I not working properly. I will attach a screen dump of the chart that doesn't work properly. If you want I can a zipped copy of my current solution but I don't know if it will help.

Regards Joost Platenburg

Suresh B [Syncfusion]
Replied On March 16, 2015 08:32 AM UTC

Hi Joost,

We infer that the problem is with your Chart data. Stacking series will be stacked only if the previous series X values are same as the current series X values. For example, if the first index DateTime value of first stacking series data should be same as first index DateTime value of second stacking series data (this including all DateTime components such as year, month, day, hour, minutes, seconds and milliseconds). If that does not matches, the series will not be stacked. If you are still unable to find the root cause for your issue, please revert us with modified sample along with the replication procedure which will be helpful for us to serve you better.

Please let us know if you require further assistance on this.

Thanks,
Suresh B


Joost Platenburg
Replied On March 16, 2015 11:06 AM UTC

Hello Suresh,

I don't think that the chart data is the problem. I found a number of things that are different from the sample you send me:
1. I use a Grid i.s.o. a StackLayout in my view.
2. I did not use a BindableObject, I used a ViewModel file which I assigned to the BindingContext of the ContentPage in the code-behind of that page i.s.o. binding it in XAML to the StackLayout.
3. I need to update the chart every minute with new data (add a column), so I can't just dump the data in the thre ObservableCollections in the constructor of the ViewModel.

I stripped my solution as much as possible, created a zip file and attached it to this thread.

I hope You can help,
Regards, Joost

Magesh Kumar Krishnan [Syncfusion]
Replied On March 17, 2015 12:03 PM UTC

Hi Joost,

We have created incident #136699 on behalf of you for this reported issue. Our support engineer will assist you through incident under your Direct Trac account. So we request you to follow with the incident for further details.
Our Direct Trac support system can be accessed from the following link:

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

Regards,
Magesh Kumar k


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

;