Remove empty zone in bar chart

Hello,

I'm using the bar chart, but my data have some missing value so the Chart display empty zone :


The "ChartEmptyPointSettings" in Drop mode don't hide this empty zone.

What is the solution to hide this empry zone without adding the missing data ?

Thanks by advance for your answer.


Regards,


5 Replies

GV Gopalakrishnan Veeraraghavan Syncfusion Team May 22, 2023 03:26 PM UTC

Hi Alexandre,


We have analyzed your query and found that we do not have the support to remove the empty zone using the “ChartEmptyPointSettings” property. It only supports linear charts. Therefore, we suggest filtering the datasource with the code snippet provided below to remove the empty zone. For your reference, we have attached a sample and screenshot. Please check the code snippet provided below.


protected override void OnInitialized()

{

   filteredDataSource = MedalDetails.Where(item => item.Y != 0).ToList();   

}


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/RemoveEmptyZone-573279260.zip


Screenshot:

A picture containing line, rectangle, plot, diagram

Description automatically generated



Kindly revert us if you have any concerns.



Regards,

Gopalakrishnan Veeraraghavan



AC Alexandre CLAVERIE May 22, 2023 05:38 PM UTC

The solution suppose that my data are continous and have Y to zero. But they do not exist in my list.


For exemple, my data are based on DateTime like this :


Value1 : 10/01/2023 1:30 ; 10
Value2 : 10/01/2023 2:00 ; 110
Value3 : 10/01/2023 2:30 ; 150
Value4 : 10/01/2023 3:00 ; 2300
Value5 : 10/01/2023 5:00 ; 50


between Value 4 et Value 5 no data exist in the list, but hte chart create empty value, how to hide it on the chart ?



GV Gopalakrishnan Veeraraghavan Syncfusion Team May 23, 2023 09:43 AM UTC

Hi Alexandre,


We recommend changing the value type of the X-axis of the chart to “DateTimeCategory” in the ChartPrimaryXAxis property in order to eliminate the empty space in the chart. We have included a sample and a screenshot for your convenience. Please refer to the code snippet below.


<ChartPrimaryXAxis  ValueType="Syncfusion.Blazor.Charts.ValueType.DateTimeCategory" />



Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/RemoveEmptyZone_(2)-1494490176.zip



Screenshot:


A picture containing screenshot, line, plot, rectangle

Description automatically generated



Kindly revert us if you have any concerns.



Regards,

Gopalakrishnan Veeraraghavan



AC Alexandre CLAVERIE May 23, 2023 03:45 PM UTC

Yes ! It's working well :)


I need now to create dynamic grouping for X axis Label, it's another story.


Thanks to you.


Regards,


Alexandre



GV Gopalakrishnan Veeraraghavan Syncfusion Team May 24, 2023 07:16 AM UTC

Hi Alexandre,


Most welcome. Please get back to us if you need any further assistance. We are always happy in assisting you.


Regards,

Gopalakrishnan Veeraraghavan


Loader.
Up arrow icon