Completed
Last Updated: 29 Sep 2015 10:50 by ADMIN
ADMIN
Danail Vasilev
Created on: 13 Mar 2015 07:26
Category: HtmlChart
Type: Feature Request
0
ADD maxDateGroups property for date categoryAxis in RadHtmlChart
The property (http://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/chart#configuration-categoryAxis.maxDateGroups) can be set through the kendoWidget:
JavaScript:

        <script>
            function OnLoad(args) {
                var kendoWidget = args.get_kendoWidget();
                kendoWidget.options.categoryAxis.maxDateGroups = 8;
                kendoWidget.options.categoryAxis.baseUnit = 'fit';
                kendoWidget.redraw();
            }
        </script>

ASPX:

        <telerik:RadHtmlChart runat="server" ID="RadHtmlChart2" Width="640px" Height="480px">
            <ClientEvents OnLoad="OnLoad" />
            <PlotArea>
                <Series>
                    <telerik:LineSeries DataFieldY="SellQuantity">
                        <LabelsAppearance DataFormatString="{1} cars sold on {0:m}">
                        </LabelsAppearance>
                        <TooltipsAppearance Color="White" DataFormatString="{1} cars sold on<br/>{0:D}" />
                    </telerik:LineSeries>
                </Series>
                <XAxis DataLabelsField="SellDate">
                    <TitleAppearance Text="Sell Date">
                    </TitleAppearance>
                    <LabelsAppearance DataFormatString="d">
                    </LabelsAppearance>
                    <MajorGridLines Color="#EFEFEF" Width="1"></MajorGridLines>
                    <MinorGridLines Color="#F7F7F7" Width="1"></MinorGridLines>
                </XAxis>
                <YAxis>
                    <TitleAppearance Text="Quantity">
                    </TitleAppearance>
                    <MajorGridLines Color="#EFEFEF" Width="1"></MajorGridLines>
                    <MinorGridLines Color="#F7F7F7" Width="1"></MinorGridLines>
                </YAxis>
            </PlotArea>
            <ChartTitle Text="Sold Cars per Date">
            </ChartTitle>
        </telerik:RadHtmlChart>

C#:

    protected void Page_Load(object sender, EventArgs e)
    {
        RadHtmlChart2.DataSource = GetData();
        RadHtmlChart2.DataBind();
    }

    protected DataTable GetData()
    {
        DataTable dt = new DataTable();

        dt.Columns.Add("ID", typeof(int));
        dt.Columns.Add("SellQuantity", typeof(int));
        dt.Columns.Add("SellDate", typeof(DateTime));

        dt.Rows.Add(1, 2, new DateTime(2011, 06, 12));
        dt.Rows.Add(2, 5, new DateTime(2011, 12, 12));
        dt.Rows.Add(3, 6, new DateTime(2012, 06, 17));
        dt.Rows.Add(4, 4, new DateTime(2012, 09, 18));
        dt.Rows.Add(5, 7, new DateTime(2013, 03, 18));

        return dt;
    }
0 comments