Axis value type double and label format "c2" don't work together

Hi, when i use the properties ValueType=ValueType.Double and LabelFormat="c2" of ChartPrimaryYAxis, the value is incorrect, for example in the image below, in the column "SP" the correct value is 959,451.52 and not 95,948,152.00 , how i fix this? i tried to use it without the property ValueType, but the value still incorrect and when i use only valuetype property the value is correct but not in the format i want. i'm using the 19.4.0.48 version of syncfusion blazor


code of chart:

<SfChart Height="450px" Width="100%" Palettes="@palettes">

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

                                        <ChartSeriesCollection>

                                            <ChartSeries DataSource="@EstatisticasUF" XName="Filtro" YName="Valor" Type="ChartSeriesType.Column">

                                                <ChartMarker>

                                                    <ChartDataLabel Visible="true" />

                                                </ChartMarker>

                                            </ChartSeries>

                                            <ChartPrimaryYAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Double" LabelFormat="c2" Minimum="0" Maximum="@ValorMaxUF">

                                            </ChartPrimaryYAxis>

                                        </ChartSeriesCollection>

                                    </SfChart>


19 Replies

SB Swetha Babu Syncfusion Team February 2, 2022 01:54 PM UTC

Hi Mateus, 

Greetings from Syncfusion. 

We can enable the useGroupingSeparator property in Chart component to achieve your requirement and we have created the simple blazor application to demonstrate the same and it can be downloaded from the below link.  


Code Snippet: 

<SfChart Height="450px" Width="100%" UseGroupingSeparator="true"
    <ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Category" /> 
    <ChartSeriesCollection> 
        <ChartSeries DataSource="@Data" XName="Filtro" YName="Valor" Type="ChartSeriesType.Column"> 
            <ChartMarker> 
                <ChartDataLabel Visible="true" /> 
            </ChartMarker> 
        </ChartSeries> 
        <ChartPrimaryYAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Double" LabelFormat="c2" Minimum="0" Maximum="1000000"> 
        </ChartPrimaryYAxis> 
    </ChartSeriesCollection> 
</SfChart> 

Screenshot: 

 

Kindly, revert us if you have any concerns. 

Regards, 
Swetha


PA Paolo April 30, 2022 06:27 AM UTC

Hi Swetha,

I continue this post because I get same issue. I'm using Blazor Syncfusion v20.1.0.50.

You will find attached 3 files:

  1. code with LabelFormat c2 applied, using as per your example UseGroupingSeparator ​setted to true.
  2. Chart image resulting from the above code
  3. Chart image without using LabelFormat 
Results: format doesn't work properly. Note that:
  • Tooltip is formatted properly, not labels
  • If I change  UseGroupingSeparator  to false​, the result is perfectly the same
Please fix as soon as possible this bug.
Thank you for your support
Paolo

Attachment: Chart_Format_Issue_5aa91088.zip


DG Durga Gopalakrishnan Syncfusion Team May 2, 2022 12:32 PM UTC

Hi Mateus,


We have ensured your reported scenario in latest version 20.1.0.51. Chart y axis labels, data labels and tooltip are formatted properly as per behavior. We have attached the tested sample for your reference.


<SfChart UseGroupingSeparator="true">

        <ChartPrimaryYAxis LabelFormat="c2"></ChartPrimaryYAxis>

</SfChart>



Sample : https://www.syncfusion.com/downloads/support/directtrac/general/ze/LabelFormat-1857490251.zip


Kindly specify in which scenario you have faced the reported problem. If you are still facing problem, please try to replicate an issue in above sample or share us issue reproduced sample to validate further from our end.


Regards,

Durga Gopalakrishnan.



PA Paolo May 2, 2022 01:23 PM UTC

Hi Durga ,

this is my result:

Immagine 2022-05-02 151912.jpg

So, I suppose it's a globalization issue. In Europe we use comma for decimals...

Best regards

Paolo



SB Sridevi Bharathi Manohar Syncfusion Team May 3, 2022 03:12 PM UTC

Hi Paolo,


We have prepared a sample using Europe locale. Please refer to below sample and change the dropdown to fr in order to select Europe locale.


Screenshot :


If you are still facing problem, please try to replicate an issue in above sample or share us issue reproduced sample to validate further from our end.


Regards,

Sridevi Bharathi.



SB Sridevi Bharathi Manohar Syncfusion Team May 3, 2022 03:17 PM UTC

Hi Paolo,

Here I attached a sample for above reponse. Please refer that.

Regards,

Sridevi Bharathi


Attachment: EuropeCulture_76f76a5c.zip


PA Paolo May 4, 2022 05:35 PM UTC

Hi Sridevi,

yes I understand the approach to fix this issue.

But unfortunately your code is for a WASM Blazor application. I'm developing a Blazor Server Application. So, for instance, in SyncfusionLocalizer class, at line 24 I cannot find Resources under my application's namespace.... moreover I have to move partially some lines from Program.cs to Startup.cs (.NET Core 5.0)  too.

So I'm not sure to fix this problem in my application.

Just a question: the CultureInfo array in CultureSwitcher razor component contains the only culture available? (the name of the variable "supportedCultures" suggests this)

Thank you

Paolo



PA Paolo May 4, 2022 05:59 PM UTC

Hi Sridevi,

I have found answers to my above questions here:

https://blazor.syncfusion.com/documentation/common/localization?cs-save-lang=1&cs-lang=csharp

And following the instructions for setting culture in a static approach.

But now, if I use it as culture (for Italian), this problem is still there (I mean the added zeroes as per comma for decimal issue), but I added a new problem: in a Syncfusion grid, as well in the same chart, the euro symbol is wrong.

Id I use the fr as culture, when I load the chart page I get an exception:

System.FormatException: Input string was not in a correct format.

   at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)

   at Syncfusion.Blazor.Charts.Chart.Internal.ChartHelper.GetLabelText(Point currentPoint, ChartSeriesRenderer seriesRenderer)


So... I'm so far from a solution!

Regards

Paolo



DG Durga Gopalakrishnan Syncfusion Team May 5, 2022 11:46 AM UTC

Hi Paolo,


We have considered your reported scenario as bug and logged a defect report for this issue. This fix will be available in our upcoming weekly patch release which is scheduled to be rolled out on 17th May 2022. We appreciate your patience until then. You can keep track of the bug from the below feedback link.


Feedback Link :  https://www.syncfusion.com/feedback/34659/localization-is-not-proper-for-european-cultures


If you have any more specification/precise replication procedure or a scenario to be tested, you can add it as a comment in the portal.


Regards,

Durga Gopalakrishnan.



PA Paolo May 5, 2022 12:02 PM UTC

Thank you Durga,

Yes I think so; also because the tooltip works perfectly (I mean without localization configuration, it takes the browser/OS settings; and values are correctly reported ). So I think there is something it doesn't work properly in labels values representation. Moreover the localization symbols are, for Europen cultures, wrong as euro symbol.

I'll wait for next release.

Best regards

Paolo Capirci



DG Durga Gopalakrishnan Syncfusion Team May 6, 2022 11:22 AM UTC

Hi Paolo,


Most welcome. We will include the fix as per mentioned timeline. We appreciate your patience until then.


Regards,

Durga Gopalakrishnan.



DG Durga Gopalakrishnan Syncfusion Team May 17, 2022 02:00 PM UTC

Hi Paolo,


We are glad to announce that our v20.1.0.56 patch release is rolled out; we have added the fix for reported issue. You can use the latest Syncfusion.Blazor.Charts NuGet package.


NuGet Package : https://www.nuget.org/packages/Syncfusion.Blazor.Charts/


We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.


Regards,

Durga Gopalakrishnan.



PA Paolo May 18, 2022 03:26 PM UTC

Hi Durga,

yes, it works perfectly now!

Thanks for the update

Best regards

Paolo



DG Durga Gopalakrishnan Syncfusion Team May 19, 2022 02:04 PM UTC

Hi Paolo,


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


Regards,

Durga Gopalakrishnan.



PA Paolo January 25, 2023 01:24 PM UTC

Hi support,

I moved my application (see previous comments) from .NET 5 and Syncfusion Blazor v20.1.0.56 (that fixed the issue), to .NET 6 using Syncfusion Blazor v20.4.0.42.

Unfortunately this new version (I know it's not the latest, but still recent) seems to have a regression on this topic. May you verify please?

Correct version (.NET 5 + v20.1.0.56)


Bug version (.NET 6 + v20.4.0.42):


As you can see, tooltips are fine in both the environments, but the data labels not. Please note that both are localized in it-IT, and that the datasource are exactly the same for both version (I consume a REST API, the same API: only razor component are different, but equal in code).

Thank you

Best regards

Paolo



DG Durga Gopalakrishnan Syncfusion Team January 30, 2023 01:30 PM UTC

Paolo,


We have considered your reported scenario as bug and logged a defect report for this issue. This fix will be available in our weekly patch release which is scheduled to be rolled out on 14th February 2023. We appreciate your patience until then. You can keep track of the bug from the below feedback link.


Feedback Link : https://www.syncfusion.com/feedback/40720/chart-datalabel-is-not-proper-for-localization


If you have any more specification/precise replication procedure or a scenario to be tested, you can add it as a comment in the portal.



DG Durga Gopalakrishnan Syncfusion Team February 15, 2023 06:28 AM UTC

Paolo,


We are glad to announce that our v20.4.0.50 patch release is rolled out; we have added the fix for reported issue. You can use the latest Syncfusion.Blazor.Charts NuGet package.


NuGet Package : https://www.nuget.org/packages/Syncfusion.Blazor.Charts/


We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.



PA Paolo February 15, 2023 08:04 AM UTC

Hi Durga ,

yes I confirm: bug fixed.

Best regards

Paolo



DG Durga Gopalakrishnan Syncfusion Team February 17, 2023 10:52 AM UTC

Paolo,


Please get back to us if you need any other concerns. We are always happy in assisting you.


Loader.
Up arrow icon