此示例演示如何为BootstrapChart实现向下钻取场景。这种方法的主要思想是在运行时切换BootstrapChart控件的数据源。为此,处理BootstrapClientChartBase.PointClick事件,然后创建适当的数组,并将其传递给BootstrapCallbackPanel控件的客户端PerformCallback方法。在回调事件处理程序中,您需要执行适当的方法来定义数据源和属性,这是将它们分配给BootstrapChart控件所必需的。
[JavaScript] function OnPointClick(s, e) { if (!button.GetEnabled()) { country = e.target.originalArgument; CreateNewArray(country); cp.PerformCallback(JSON.stringify(fruits) + "|" + country); } }
[C#] void SwitchChart(string parameter) { bootstrapbutton1.ClientEnabled = true; string[] paramArray = parameter.Split('|'); var jss = new JavaScriptSerializer(); Dictionary<string, string> dic = jss.Deserialize<Dictionary<string, string>>(paramArray[0]); BootstrapChartBarSeries barSeries1 = new BootstrapChartBarSeries { ValueField = "CategoryCount", ArgumentField = "FruitCategory", Name = "By groups" }; BootstrapChart1.TitleText = string.Format("Fruits chart in {0}", paramArray[1]); BootstrapChart1.DataSource = GetBootstrapChartData(dic); BindChart(barSeries1); }
本站文章除注明转载外,均为本站原创或翻译
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [https://www.devexpresscn.com/]
本文地址:https://www.devexpresscn.com/post/1117.html
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [https://www.devexpresscn.com/]
本文地址:https://www.devexpresscn.com/post/1117.html