Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
Format Label with Date Values in igDataChart for ASP.NET MCV Razor
posted

I have spent several hours (several!) trying to find a answer to what should be a very very simple thing to accomplish.
I am trying out the igDataChart by displaying some sales numbers by the first date of a week. I cannot find how to display the x axis date value is this format MM/dd/yy. The charte is displaying the date as long hand as possible. I am extremely frustrated  that there is no help for such a simple common thing. Please end my frustration and provide me with a resolution to this simple matter.. The following is part of my my cart code in ASP.NET MCV Razor. The cart displays the correct data but the x axis labels are a joke

             @(Html.Infragistics().DataChart(Model.OrderWeeklySales.AsQueryable())
                        .ID("chart")
                        .AlignsGridLinesToPixels(true)
                        .VerticalZoomable(true)
                        .HorizontalZoomable(true)
                        .OverviewPlusDetailPaneVisibility(Visibility.Collapsed)
                        .Legend(legend => legend.ID("dataLegend"))
                        .Height("400px")
                        .Width("100%")
                        //.Width("900px")
                        .Title("Weekley Sales by Product")
                        .Subtitle("")

                        .Axes(axis =>
                        {
                            axis
                            .CategoryX("xAxis")
                            //.Label(item => item.Week)
                            //.Label(item => Convert.ToDateTime(String.Format("{0:MM/dd/yy}", item.FirstDateOfWeek)).Date.ToString())
                            //.Label(item => String.Format(item.FirstDateOfWeek.ToString(), "MM/dd/yy"))
                            .Label(item => item.FirstDateOfWeek)
                            //.Label(item => String.Format("{0:MM/dd}", item.FirstDateOfWeek))
                            //.FormatLabel("MM/dd/yy")
                            //.FormatLabel(String.Format("{0:MM/dd/yy}", Model.FirstDateOfWeek))
                            .Title("Week Of")
                            //.LabelAngle(45)
                            //.TitleAngle(90)
                            .LabelLocation(AxisLabelsLocation.OutsideBottom)
                            .Interval(1).LabelLocation(AxisLabelsLocation.OutsideBottom)
                            .StrokeThickness(2)
                            .MajorStroke("#f4f4f4")
                            .MinorStrokeThickness(1);


                            axis
                            .NumericY("yAxis")
                            //.MinimumValue(0)
                            //.MaximumValue(100)
                            .Title("Quantity Sold");
                        })

Parents
  • 0
    Offline posted

    When it comes to finding the best motherboard for office and company work, it is important to take all the above factors into consideration. Doing so will ensure that the business can benefit from the most efficient and cost-effective motherboard available. A motherboard is an important component of any business, and it should be chosen with care. https://justmotherboard.com/best-rgb-motherboard/

Reply Children
No Data