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

XAxis Date Format - Remove Generated Dates

Hi,
I have a stacked chart, that shows the last 7 days of data.
If i show the axis as "text" it puts the values as text i.e. 03/02/2020 , 04/02/2020 , 05/02/2020 , 29/01/2020, 30/01/2020, 31/01/2020
If i set the axis as Dateformat it correctly orders it, but it includes dates where no data exists.
Picture attached.
How do i set the chart to not include these?
(example here is 01/02/2020 & 02/02/2020)

Code used:
        Me.cht_Last7Days.PrimaryXAxis.ValueType = ChartValueType.DateTime
        Me.cht_Last7Days.PrimaryXAxis.DateTimeFormat = "dd/MM/yyyy"
        Me.cht_Last7Days.PrimaryXAxis.DateTimeRange = New ChartDateTimeRange(StartDate, StartDate.AddDays(6), 1, ChartDateTimeIntervalType.Days)

Thanks




Attachment: chart_946ecc76.zip

3 Replies

HM Hemalatha Marikumar Syncfusion Team February 6, 2020 01:14 PM UTC

Hi Crampo, 
  
Greetings from Syncfusion. 
  
You achieve your requirement by setting the Indexed as True as per the below code snippet. 
  
Code Snippet [Xaml]: 
  
Me.cht_Last7Days.PrimaryXAxis.Indexed = True 
  
  
Please let us know if need any further assistance on this. 
 
Regards,
Hemalatha M. 



CR Crampo replied to Hemalatha Marikumar February 7, 2020 02:32 PM UTC

Hi Crampo, 
  
Greetings from Syncfusion. 
  
You achieve your requirement by setting the Indexed as True as per the below code snippet. 
  
Code Snippet [Xaml]: 
  
Me.cht_Last7Days.PrimaryXAxis.Indexed = True 
  
  
Please let us know if need any further assistance on this. 
 
Regards,
Hemalatha M. 


Hi,
Thanks For your reply.
Unfortunatly when i add 
"cht_Last7Days.PrimaryXAxis.Indexed = True"
It tells me that this property is not used anymore.
And doesnt have any affect on the outcome of the chart.

Best Regards
Alex


HM Hemalatha Marikumar Syncfusion Team February 10, 2020 12:08 PM UTC

Hi Crampo, 
  
We would like to let you know that Indexed property is working fine at our end. Please find the tested sample from below link. 
  
  
Screenshot
Before setting Indexed 
After setting Indexed 
 
 
  
As we can't know your exact application scenario, couldn't replicate the issue in your case. Could you please provide the complete chart control code snippet which is used in your application? If possible, can you please revert us by modifying the provided sample based on your application along with replication procedure. This will be helpful for us to provide you better solution at the earliest. 
 
Regards,
Hemalatha M. 


Loader.
Live Chat Icon For mobile
Up arrow icon