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
close icon

Fix chart first point to origine

I am using a Chart Control into Asp MVC project (column type)
I would like that the first point will be drawn at the origin point.
I look at internet and the only solution is to used DateTime lable on XAxis.
Actually, my X Axis type is not date time (I have to use string type).
Regards,
Selem



1 Reply

DD Dharanidharan Dharmasivam Syncfusion Team April 5, 2017 01:39 PM UTC

Hi Selem, 

Thanks for contacting Syncfusion support. 

We have analyzed your query. We would like to let you know that, in our previous releases, the column series (first and last point) get clipped and rendered, but this is not the correct behavior, actually the column has to visible fully, so we have added the interval with start and end points by inbuild and now the column will not be clipped. This is the current behavior of our chart control. 

Also your requirement can be achieved as workaround. Render the chart in numeric axis and by using AxesLabelRendering event, the text of the PrimaryXAxis can be changed and also you need to specify the range for PrimaryXAxis to render chart from origin, as depicted in the below code snippet. 

ASP.NET MVC [C#]: 

@(Html.EJ().Chart("container") 
        .PrimaryXAxis(pr => pr.Range(ra => ra.Max(7).Min(1).Interval(1)).ValueType(AxisValueType.Double)) 
        //... 
        .AxesLabelRendering("labelRender") 
 ) 
 
function labelRender(sender) { 
        var xLabel = ["USA", "China", "Japan", "Australia", "France", "Germany", "Italy", "Sweden"] 
        if (sender.data.axis.orientation == "horizontal") { 
            window.count = ej.util.isNullOrUndefined(window.count) ? 0 : window.count + 1; 
            sender.data.label.Text = xLabel[window.count]; 
        } 
    } 

Screenshot: 
 
 
Sample for reference can be find from below link. 
 
Thanks, 
Dharani. 


Loader.
Live Chat Icon For mobile
Up arrow icon