Jul 05, 2012, 3:44 PM
[CLOSED] storeItem (the currently highlighted item) for charttips
I have problem not able to find out the triggering element of the tips from chart, using the following code:
The following is the complete code that you can use to try it out. Thank you so much
<Tips ID="tipCore" runat="server" TrackMouse="true" Width="580" Height="170" >
<Loader ID="Loader1" runat="server" DisableCaching="true" Mode="Frame" ShowMask="true"> <LoadMask ShowMask="true" /> </Loader>
<Listeners>
<BeforeShow Handler="#{DirectMethods}.UpdateAssetToolTips('I_WANT_TO_Get_THE_HIGHLIGHTED_CODE');"></BeforeShow>
</Listeners>
</Tips>
If I use <Renderer> inside <Tips> I can get the storeItem and find out exactly what is highlighted. However I want to use a loader to load an URL when a chart element is highlighted. The Listeners did pass TriggerElement to the handler but that looks like it always equal to "true". Similar code works in gridview (using view.getRecord(this.triggerElement)) but I have no idea how to get the item under the charttips.The following is the complete code that you can use to try it out. Thank you so much
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
strCoreCollectives.Data = new object[] {
new {
instCode="1234567890",
instName="test12345678901234567890",
amount=10000,
instPerc=10
},
new {
instCode="3234567890",
instName="test32345678901234567890",
amount=30000,
instPerc=30
},
new {
instCode="2234567890",
instName="test22345678901234567890",
amount=20000,
instPerc=20
}
};
strCoreCollectives.DataBind();
}
[DirectMethod]
public void UpdateAssetToolTips(string instrumentCode)
{
myChart.Series[0].Tips.LoadContent("A_DEFINED_PAGE?instrumentCode=" + instrumentCode, true);
}
</script>
<!DOCTYPE html>
<html>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Panel ID="Panel1" runat="server" >
<Items>
<ext:Chart
ID="myChart"
runat="server"
StyleSpec="background:#fff;"
Shadow="true"
Animate="true"
Width="300"
Height="300"
>
<Store>
<ext:Store ID="strCoreCollectives" runat="server" AutoDataBind="true">
<Model>
<ext:Model ID="Model12" runat="server" IDProperty="instCode">
<Fields>
<ext:ModelField Name="instCode" />
<ext:ModelField Name="instName" />
<ext:ModelField Name="amount" Type="Float"/>
<ext:ModelField Name="instPerc" Type="Float" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<Axes>
<ext:CategoryAxis
Fields="instName"
Title="Instruments"
Position="Bottom"
>
<LabelTitle FontSize="10" >
</LabelTitle>
<Label FontSize="8" >
<Rotate Degrees="270" />
<Renderer Handler="return Ext.String.ellipsis(value, 15, false);" />
</Label> </ext:CategoryAxis>
<ext:NumericAxis
Fields="amount"
Position="Left"
Grid="true"
Title="Amount"
>
<LabelTitle FontSize="10" >
</LabelTitle>
<Label FontSize="8" ></Label>
</ext:NumericAxis>
</Axes>
<Series>
<ext:ColumnSeries
Highlight="true"
XField="instName"
YField="amount"
Axes="Left" Column="true"
>
<Tips ID="tipCore" runat="server" TrackMouse="true" Width="580" Height="170" >
<Loader ID="Loader1" runat="server" DisableCaching="true" Mode="Frame" ShowMask="true"> <LoadMask ShowMask="true" /> </Loader>
<Listeners>
<BeforeShow Handler="#{DirectMethods}.UpdateAssetToolTips('Get_HIGHLIGHTED_CODE');"></BeforeShow>
</Listeners>
</Tips>
</ext:ColumnSeries>
</Series>
</ext:Chart>
</Items>
</ext:Panel>
</form>
</body>
</html>
Last edited by Daniil; Jul 10, 2012 at 11:24 AM.
Reason: [CLOSED]