Approved
Last Updated: 18 Dec 2017 13:52 by ADMIN
ADMIN
Danail Vasilev
Created on: 05 Jun 2014 08:46
Category: HtmlChart
Type: Feature Request
5
ADD ability to modify the aggregate function that applies to category series with date axis in RadHtmlChart
The feature should be like the one in KendoUI' https://docs.telerik.com/kendo-ui/api/javascript/dataviz/ui/chart#configuration-series.aggregate
For the time being it can be set through the chartObject:
ASPX:
		<telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
		<script type="text/ecmascript">
			function pageLoad() {
				var chart = $find("<%=RadHtmlChart1.ClientID%>");
				chart._chartObject.options.series[0].aggregate = "sum";
				chart.repaint();
			}
		</script>
		<telerik:RadHtmlChart runat="server" ID="RadHtmlChart1" Width="640px" Height="480px">
			<PlotArea>
				<Series>
					<telerik:LineSeries DataFieldY="SellQuantity">
					</telerik:LineSeries>
				</Series>
				<XAxis BaseUnit="months" DataLabelsField="SellDate">
					<LabelsAppearance DataFormatString="d">
					</LabelsAppearance>
				</XAxis>
			</PlotArea>
		</telerik:RadHtmlChart>
C#:
        using System.Data;
	protected void Page_Load(object sender, EventArgs e)
	{
		RadHtmlChart1.DataSource = GetData();
		RadHtmlChart1.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(2012, 06, 12));
		dt.Rows.Add(2, 5, new DateTime(2012, 06, 13));
		dt.Rows.Add(3, 6, new DateTime(2012, 06, 17));
		dt.Rows.Add(4, 4, new DateTime(2012, 07, 18));
		dt.Rows.Add(5, 7, new DateTime(2012, 07, 20));

		return dt;
	}
0 comments