[CLOSED] storeItem (the currently highlighted item) for charttips

  1. #1

    [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:

     
     <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]
  2. #2
    Hi,

    It can be implemented this way.

    Example
    <Tips 
        runat="server" 
        TrackMouse="true" 
        Width="580" 
        Height="170">
        <Renderer Handler="this.on(
                                'show', 
                                function () {
                                    this.load({
                                        url    : 'Test.aspx',
                                        params : {
                                            data : Ext.encode(storeItem.data)
                                        }
                                    });
                                }, 
                                this, { 
                                    single : true
                                });" />
        <Loader 
            runat="server" 
            Mode="Frame"
            Url="Test.aspx  "
            DisableCaching="true" 
            AutoLoad="false">
            <LoadMask ShowMask="true" />
        </Loader>
    </Tips>
  3. #3
    Thank you so so so much. :) It works perfectly. If anyone else try to implement this, I've got a tiny problem of string the string from storeItem.get('PROPERTY'),
    the string that I got back from the ajax parameter has extra double quote (") surrounded. You might need to remove that before anything with it. Use this:
    .Replace("\"", "")
    Just a curious Danii, while trying to figure out how to do this, I've tried going through all the chart and series object from the javascript side but didn't find a property to get the currently highlighted item of the chart, is that possible to get that without the Renderer event? (say I might need to know that at other moments.)
  4. #4
    Quote Originally Posted by CarpFisher View Post
    If anyone else try to implement this, I've got a tiny problem of string the string from storeItem.get('PROPERTY'),
    the string that I got back from the ajax parameter has extra double quote (") surrounded. You might need to remove that before anything with it. Use this:
    .Replace("\"", "")
    Well, I guess you just should not Ext.encode a simple string property.

    Quote Originally Posted by CarpFisher View Post
    Just a curious Danii, while trying to figure out how to do this, I've tried going through all the chart and series object from the javascript side but didn't find a property to get the currently highlighted item of the chart, is that possible to get that without the Renderer event? (say I might need to know that at other moments.)
    Please investigate the showTip method of the Ext.chart.Tip class.
    http://docs.sencha.com/ext-js/4-1/so...#Ext-chart-Tip
  5. #5

    Ext.encode(storeItem.data)

    Hi,

    I am also working on the similar page, i would like to know how to get Ext.encode(storeItem.data) data in test.aspx page. Please help.
  6. #6
    Hi @mjad4u,

    Sorry, I don't understand the question. Please elaborate.
  7. #7
    Hi Daniil,


    I have a parent page having one chart on columnseries mouse move i would like to show tips window through the loader where i am loading child page 'Test.aspx'. the problem is how to retrieve the parameter value in 'Test.aspx' i can see params : { data : Ext.encode(storeItem.data) } }); is getting passed to the 'Test.aspx' but have no idea how to retrieve it in 'Test.aspx'.


    Also possible can we pass the storeItem.get('Month') as a parameter.
    exampe
    1)
    <ext:Parameter Name="VAL" Value="Ext.encode(storeItem.data)" Mode="Raw">
    1)
    <ext:Parameter Name="VAL" Value="storeItem.get('Month') " Mode="Raw">

    Please help

    Code example

    <Series>
    <ext:ColumnSeries Highlight="true" XField="instName" YField="amount" Axes="Left"
    Column="true">
    <Tips ID="Tips1" runat="server" TrackMouse="true" Width="580" Height="170">
    <Renderer Handler="this.on(function () {
    this.load({ url : 'Test.aspx', 
    params : { 
    data : Ext.encode(storeItem.data) } }); },
    this, { single : true });" />
    <Loader ID="Loader1" runat="server" Mode="Frame" Url="Test.aspx" DisableCaching="true">
    <LoadMask ShowMask="true" />
    <Params>
    <ext:Parameter Name="VAL" Value="Ext.encode(storeItem.data)" Mode="Raw">
    </ext:Parameter>
    </Params>
    </Loader>
    </Tips>
    </ext:ColumnSeries>
    </Series>

    Quote Originally Posted by Daniil View Post
    Hi @mjad4u,

    Sorry, I don't understand the question. Please elaborate.
    Last edited by Daniil; Nov 27, 2012 at 4:36 PM. Reason: Please use [CODE] tags
  8. #8
    The following works for me.

    Tips
    <Tips runat="server" Width="300" Height="100">
        <Renderer Handler="this.load({
                               params: {
                                   data: Ext.encode(storeItem.data)
                               }                                    
                           });" />
        <Loader runat="server" Mode="Frame" Url="Test.aspx" AutoLoad="false" />
    </Tips>
    Child Page
    <%@ Page Language="C#" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Form.Controls.Add(new Literal() { Text = this.Request["data"] });
        }
    </script>
     
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <form runat="server">
        
        </form>
    </body>
    </html>

Similar Threads

  1. [CLOSED] DatePicker Day Highlighted in 2.x
    By supera in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Aug 20, 2013, 8:30 AM
  2. DatePicker Day Highlighted
    By gefferson.librelato in forum 1.x Help
    Replies: 5
    Last Post: Jan 27, 2012, 1:16 PM
  3. [CLOSED] DatePicker day highlighted
    By methode in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jan 13, 2012, 10:32 AM
  4. [CLOSED] Menu not close and remain highlighted after clicked
    By nhg_itd in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Oct 03, 2011, 5:50 AM
  5. [CLOSED] selected row are partially highlighted on gridpanel
    By leon_tang in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Sep 19, 2011, 1:41 PM

Tags for this Thread

Posting Permissions