Hi!
I am trying to build a page using multiple radHtmlCharts, all of them with drill down functionality.
Followed the steps described in the demo page: http://demos.telerik.com/aspnet-ajax/htmlchart/examples/drilldownchart/defaultvb.aspx?show-source=true
I am using onClientSeriesClicked event and the AjaxRequest event of the Ajax Manager to force drill down. As far as i understand I can have only one Ajax Manager in my page and all of my htmlCharts points to the same AjaxRequest.
Here is the code (sample) in my .aspx page:
<head runat="server">
...
<script src="script.js" type="text/javascript"></script>
</head>
...
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
OnAjaxRequest
=
"RadAjaxManager1_AjaxRequest"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadAjaxManager1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadHtmlChartAverageImageResolutionOfCountries"
LoadingPanelID
=
"AjaxLoadingPanel1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadAjaxManager1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadHtmlChartAverageComplianceOfCountries"
LoadingPanelID
=
"AjaxLoadingPanel1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
...
</
telerik:RadAjaxManager
>
<
telerik:RadAjaxLoadingPanel
ID
=
"AjaxLoadingPanel1"
runat
=
"server"
Skin
=
"BlackMetroTouch"
>
</
telerik:RadAjaxLoadingPanel
>
<
telerik:RadCodeBlock
ID
=
"RadCodeBlock65"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function getAjaxManager()
{
return $find("<%=RadAjaxManager1.ClientID%>");
}
</
script
>
</
telerik:RadCodeBlock
>
...
<
div
class
=
"col4"
>
<
telerik:RadHtmlChart
runat
=
"server"
ID
=
"RadHtmlChartAverageImageResolutionOfCountries"
OnClientSeriesClicked
=
"AverageImageResolutionOfCountriesOnClientSeriesClicked"
Skin
=
"Black"
Height
=
"280"
<
Appearance
>
<
FillStyle
BackgroundColor
=
"#262626"
></
FillStyle
>
</
Appearance
>
<
ChartTitle
Text
=
"XXXXX1">
</
ChartTitle
>
<
PlotArea
>
<
Series
>
<
telerik:ColumnSeries
Name
=
"Countries"
DataFieldY
=
"AverageImageResolution"
>
...
</
telerik:ColumnSeries
>
</
Series
>
<
XAxis
DataLabelsField
=
"Country"
>
</
XAxis
>
<
YAxis
>
</
YAxis
>
</
PlotArea
>
</
telerik:RadHtmlChart
>
</
div
>
...
<
div
class
=
"chart3"
>
<
telerik:RadHtmlChart
runat
=
"server"
ID
=
"RadHtmlChartAverageComplianceOfCountries"
OnClientSeriesClicked
=
"AverageComplianceOfCountriesOnClientSeriesClicked"
Skin
=
"Black"
Height
=
"300"
>
<
ChartTitle
Text
=
"XXXXXX2"
>
</
ChartTitle
>
<
PlotArea
>
<
Series
>
<
telerik:ColumnSeries
Name
=
"Countries"
DataFieldY
=
"Compliance"
>
...
</
telerik:ColumnSeries
>
</
Series
>
<
XAxis
DataLabelsField
=
"Country"
>
</
XAxis
>
<
YAxis
>
</
YAxis
>
</
PlotArea
>
</
telerik:RadHtmlChart
>
</
div
>
...
So, if i try to drill down a specific radHtmlChart all the other charts are also getting refreshed and if they use the same categories (ColumnSeries: Countries) then they also drill down (if not, then they just load empty).
The script i am using (script.js):
(
function
(global, undefined) {
global.AverageImageResolutionOfCountriesOnClientSeriesClicked =
function
(sender, args) {
var
ajaxManager = global.getAjaxManager();
if
(args.get_seriesName() !==
"Sites"
) {
ajaxManager.ajaxRequest(args.get_category());
}
}
})(window);
(
function
(global, undefined) {
global.AverageComplianceOfCountriesOnClientSeriesClicked =
function
(sender, args) {
var
ajaxManager = global.getAjaxManager();
if
(args.get_seriesName() !==
"Sites"
) {
ajaxManager.ajaxRequest(args.get_category());
}
}
})(window);
And in VB code:
Protected
Sub
RadAjaxManager1_AjaxRequest(sender
As
Object
, e
As
AjaxRequestEventArgs)
' Drill down for Average Image Resolution ''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim
seriesNameRes
As
String
= RadHtmlChartAverageImageResolutionOfCountries.PlotArea.Series(0).Name
If
seriesNameRes =
"Countries"
Then
Dim
CountryRes
As
String
= (e.Argument).ToString
RadHtmlChartAverageImageResolutionOfCountries.PlotArea.XAxis.DataLabelsField =
"Site"
RadHtmlChartAverageImageResolutionOfCountries.PlotArea.Series(0).DataFieldY =
"AverageImageResolution"
RadHtmlChartAverageImageResolutionOfCountries.PlotArea.Series(0).Name=
"Sites"
RadHtmlChartAverageImageResolutionOfCountries.DataSource = GetAverageImageResolutionOfCountrySites(CountryRes)
RadHtmlChartAverageImageResolutionOfCountries.DataBind()
End
If
' Drill down for Compliance ''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim
seriesNameCmpl
As
String
= RadHtmlChartAverageComplianceOfCountries.PlotArea.Series(0).Name
If
seriesNameCmpl =
"Countries"
Then
Dim
CountryCmpl
As
String
= (e.Argument).ToString
RadHtmlChartAverageComplianceOfCountries.PlotArea.XAxis.DataLabelsField =
"Site"
RadHtmlChartAverageComplianceOfCountries.PlotArea.Series(0).DataFieldY =
"Compliance"
RadHtmlChartAverageComplianceOfCountries.PlotArea.Series(0).Name=
"Sites"
RadHtmlChartAverageComplianceOfCountries.DataSource = GetAverageComplianceOfCountrySites(CountryCmpl)
RadHtmlChartAverageComplianceOfCountries.DataBind()
End
If
End
Sub
How could i refresh only the HtmlChart for which i am calling the onClientSeriesClicked event?
Thanks!
Thanasis