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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Y is displayed differently (w/ and w/o time portion).

Thread ID:

Created:

Updated:

Platform:

Replies:

148914 Nov 7,2019 05:06 PM UTC Nov 8,2019 08:43 AM UTC Blazor 2
loading
Tags: Charts
Dan Cheremisinov
Asked On November 7, 2019 05:11 PM UTC

@using Syncfusion.EJ2.Blazor.Charts
DataSource="@GetData1()" XName="X" YName="Y" Type="ChartSeriesType.Line">
DataSource="@GetData2()" XName="X" YName="Y" Type="ChartSeriesType.Line">
Position="LegendPosition.Bottom">
DataSource="@GetData3()" XName="X" YName="Y" Type="ChartSeriesType.Line">
Position="LegendPosition.Bottom">
@code{
public class ChartData
{
public DateTime X;
public int Y;
}
public List GetData1()
{
return new List()
{
new ChartData { X = new DateTime(2019,11,5), Y = 279},
new ChartData { X = new DateTime(2019,11,15), Y = 32},
new ChartData { X = new DateTime(2019,11,20), Y = 216},
new ChartData { X = new DateTime(2019,11,23), Y = 71},
new ChartData { X = new DateTime(2019,11,25), Y = 69}
};
}
public List GetData2()
{
return new List()
{
new ChartData { X = new DateTime(2019,11,5), Y = 88},
new ChartData { X = new DateTime(2019,11,15), Y = 16},
new ChartData { X = new DateTime(2019,11,20), Y = 72},
new ChartData { X = new DateTime(2019,11,23), Y = 23},
new ChartData { X = new DateTime(2019,11,25), Y = 21}
};
}
public List GetData3()
{
return new List()
{
new ChartData { X = new DateTime(2019,11,5), Y = 310},
new ChartData { X = new DateTime(2019,11,15), Y = 33},
new ChartData { X = new DateTime(2019,11,20), Y = 226},
new ChartData { X = new DateTime(2019,11,23), Y = 76},
new ChartData { X = new DateTime(2019,11,25), Y = 78},
new ChartData { X = new DateTime(2019,11,01), Y = 1}
};
}
public List GetData4()
{
return new List()
{
new ChartData { X = new DateTime(2019,11,5), Y = 88},
new ChartData { X = new DateTime(2019,11,15), Y = 16},
new ChartData { X = new DateTime(2019,11,20), Y = 72},
new ChartData { X = new DateTime(2019,11,23), Y = 23},
new ChartData { X = new DateTime(2019,11,25), Y = 21}
};
}
}
<chartseries name="first" <="" div="">
<chartseries name="second" <="" div="">
<chartlegendsettings visible="true" togglevisibility="true" <="" div="">
<chartseries name="wrong" <="" div="">
Hi everyone!
In my example I have the 1st chart is OK for me and it has Y shown as date w/o time
And for some reason for the second chart Y displayed with time portion.
Can I control that behaviour ?


Dan Cheremisinov
Replied On November 7, 2019 05:27 PM UTC

the full example is attached


Attachment: testchart_ca18f0df.zip


Srihari Muthukaruppan [Syncfusion]
Replied On November 8, 2019 08:43 AM UTC

Hi Dan, 

Greetings from syncfusion. 

We have analyzed your query. From that, we would like to let you know that, we can achieve your requirement using “labelFormat” property in primaryXAxis of chart. Based on that we have prepared a sample for your reference. Please find the below sample and code snippet. 

Code Snippet: 
<EjsChart Width="84%"> 
    <ChartPrimaryXAxis ValueType="Syncfusion.EJ2.Blazor.Charts.ValueType.DateTimeCategory" LabelFormat="M/d/y"></ChartPrimaryXAxis> 
    <ChartPrimaryYAxis RangePadding="ChartRangePadding.Round"> 
    </ChartPrimaryYAxis> 
    <ChartSeriesCollection> 
        <ChartSeries Name="wrong" 
                     DataSource="@GetData3()" XName="X" YName="Y" Type="ChartSeriesType.Line"> 
            <ChartMarker> 
                <ChartDataLabel Visible="true"></ChartDataLabel> 
            </ChartMarker> 
        </ChartSeries> 
    </ChartSeriesCollection> 
    <ChartLegendSettings Visible="true" ToggleVisibility="true" 
                         Position="LegendPosition.Bottom"></ChartLegendSettings> 
</EjsChart> 

 
Screenshot: 
 
 
Let us know if you have any concerns. 

Regards 
Srihari M 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon