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. Image for the cookie policy date

1970 in X-Axis when no series visible

Hello,When I make invisible all the series in a chart, the date that the chart has in the X-Axis is 1970. I would like to maintain the old date. Is this possible?Regards, David.

5 Replies

SP Saravana Pandian Murugan Syncfusion Team August 2, 2017 07:16 AM UTC

Hi David, 
  
Thanks for using Syncfusion products. 
  
You can achieve this requirement by using the below solutions. 
  
1. By setting Minimum and Maximum to PrimaryAxis, you can achieve this requirement. Please refer the code snippet below. 
  
Code Example: 
  
 
<chart:SfChart.PrimaryAxis> 
  
   <chart:DateTimeAxis Minimum="1/1/2015" Maximum="5/1/2015"/> 
  
</chart:SfChart.PrimaryAxis> 
  
  
2. We suggest you to set Opacity to ChartSeries instead of collapsing the series visibility. Please refer the code snippet below. 
  
Code Example:  
  

series.Opacity = 0.1; 
  
  
We have attached sample for your reference which can be downloaded from the following location. 
  
  
Please check the attached sample and let us know if you need further assistance on this. 
  
Regards, 
Saravana Pandian M. 



DP David Perera August 2, 2017 08:58 AM UTC

Hello,


The second solution does not fit to me since I can have more than one serie, and I need to make visible/invisible some of them to see others (changing the Y values).

So I tried with the first option. The problem is that when I try to put the minimum and maximum to their default values (null) in order to compute the series by themselves I encounter with this exception:

INIT EXCEPTION(iOS)----------------------------

2017-08-02 10:54:28.366 IDboxMobileiOS[96619:3378762] (iOS):System.ArgumentNullException: Value cannot be null.

Parameter name: value

  at Syncfusion.SfChart.iOS.SFRangeAxisBase.set_Minimum (Foundation.NSObject value) [0x00006] in <c2fbd626cba24da8b1c7075fae21dfa4>:0 

  at Syncfusion.SfChart.XForms.iOS.ChartAxisMapping.OnDateTimeAxisPropertiesChanged (System.String propertyName, Syncfusion.SfChart.XForms.DateTimeAxis formDateTimeAxis, Syncfusion.SfChart.iOS.SFDateTimeAxis nativeDateTimeAxis) [0x00136] in <faf947cc9ca647adb02d7480416ea715>:0 

  at Syncfusion.SfChart.XForms.iOS.ChartAxisMapping.OnChartAxisPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x0006d] in <faf947cc9ca647adb02d7480416ea715>:0 

  at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x0000a] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:136 

  at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.F

orms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.BindableObject+SetValueFlags attributes, System.Boolean silent) [0x000f4] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:589 

  at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.BindableObject+SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x0015b] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:386 

  at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, System.Boolean fromStyle, System.Boolean checkAccess) [0x0005f] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\BindableObject.cs:539 

  at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Form

s.Core\BindableObject.cs:83 

  at Syncfusion.SfChart.XForms.DateTimeAxis.set_Minimum (System.Nullable`1[T] value) [0x00000] in <58bd539bfe7d461b894d1c0dd30b37a5>:0 

  at IDboxMobile.Views.GraphsView+<>c__DisplayClass15_1.<CreateLegend>b__0 (System.Object sender, System.EventArgs e) [0x00119] in C:\Proyectos\IDbox\src\trunk\Clients\AppMobile\IDboxMobile\IDboxMobile\Views\GraphsView.cs:278 

  at Xamarin.Forms.TapGestureRecognizer.SendTapped (Xamarin.Forms.View sender) [0x0002e] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Core\TapGestureRecognizer.cs:46 

  at Xamarin.Forms.Platform.iOS.EventTracker+<>c__DisplayClass12_0.<GetNativeRecognizer>b__0 (UIKit.UITapGestureRecognizer r) [0x00045] in C:\BuildAgent3\work\ca3766cfc22354a1\Xamarin.Forms.Platform.iOS\EventTracker.cs:94 

  at UIKit.UITapGestureRecognizer+Callback.Activated (UIKit.UITapGestureRecognizer sender) [0x00000] in /Users/builder/data/lanes/4691/d2270eec/source/xamarin-macios/src/UIKit/UIGestureRecognizer.cs:211 

--- End of stack trace from p

revious location where exception was thrown ---

  at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)

  at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/4691/d2270eec/source/xamarin-macios/src/UIKit/UIApplication.cs:79 

  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/4691/d2270eec/source/xamarin-macios/src/UIKit/UIApplication.cs:63 

  at IDboxMobile.iOS.Application.Main (System.String[] args) [0x00002] in C:\Proyectos\IDbox\src\trunk\Clients\AppMobile\IDboxMobile\IDboxMobile.iOS\Main.cs:19 

2017-08-02 10:54:28.366 IDboxMobileiOS[96619:3378762] END EXCEPTION(iOS)-----------------------------



A code snippet so you can understand:

               if (allSeriesInvisible)

                    {//just for not show 1970

                        ((DateTimeAxis)chart.PrimaryAxis).Minimum = rangeNavigator.ViewRangeStart;

                        ((DateTimeAxis)chart.PrimaryAxis).Maximum = rangeNavigator.ViewRangeEnd;

                    }

                    else

                    {//default values

                        ((DateTimeAxis)chart.PrimaryAxis).Minimum = null;

                        ((DateTimeAxis)chart.PrimaryAxis).Maximum = null;

                    }

Thanks!!!



SP Saravana Pandian Murugan Syncfusion Team August 3, 2017 12:47 PM UTC

Hi David, 
 
We were able to reproduce the reported issue in iOS platform. We have already fixed this issue. The fix will be included in our upcoming Volume 3, 2017 release which is expected to be rolled out by the first week of August. 
 
To overcome this issue, we kindly request you to set new DateTime values to Minimum, Maximum instead of setting null. Please find the code snippet below. 
 
Code Example: 
 
  
(Chart.PrimaryAxis as DateTimeAxis).Minimum = new DateTime(2015, 01, 01); 
 
(Chart.PrimaryAxis as DateTimeAxis).Minimum = new DateTime(2015, 01, 01); 
 
 
Please let us know if you need further assistance on this. 
 
Regards, 
Saravana Pandian M. 



DP David Perera August 16, 2017 08:10 AM UTC

With Volume 3, 2017 release I have been able to solve my problem.

Thanks!



PS Parthiban Sundaram Syncfusion Team August 17, 2017 11:48 AM UTC

Hi David,

Thanks for the update.

We are glad to know that the reported issue has been resolved at your end. Please let us know if you need any further assistance on this.

Regards,
Parthiban S


Loader.
Live Chat Icon For mobile
Up arrow icon