[CLOSED] 3D pie chart: rotate & itemclick (IE vs. Firefox)

  1. #1

    [CLOSED] 3D pie chart: rotate & itemclick (IE vs. Firefox)

    Rotating the chart in IE works fine, but in Firefox it will also trigger the ItemClick. The ItemClick works as expected in IE - only when you click (with no rotation action).

    How can I fix the Firefox behaviour?

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
       <title></title>
       <script type="text/javascript">
          Ext.define('Ext.chart.series.Pie3D', {
             override: 'Ext.chart.series.Pie3D',
             updateLabelData: function ()
             {
                return true;
             }
          });
       </script>
       <script runat="server">
          protected void Page_Load( object sender, EventArgs e )
          {
             if ( !X.IsAjaxRequest )
             {
                this.storeDestinations.DataSource = this.Data;
                this.storeDestinations.DataBind();
             }
          }
    
          private object[] Data
          {
             get
             {
                return new object[]
                {
                    new object[] { "3m Co", 270 },
                    new object[] { "Alcoa Inc", 253 },
                    new object[] { "Altria Group Inc", 217 },
                    new object[] { "American Express Company", 58 },
                    new object[] { "American International Group, Inc.", 53 },
                    new object[] { "AT&T Inc.", 30 },
                    new object[] { "Boeing Co.", 24 },
                    new object[] { "Caterpillar Inc.", 21 },
                    new object[] { "Citigroup, Inc.", 14 },
                    new object[] { "Exxon Mobil Corp",180 }
                };
             }
          }
       </script>
    </head>
    <body>
       <form id="form1" runat="server">
          <ext:ResourceManager runat="server" />
    
          <ext:Panel runat="server" Width="650" Height="500" Layout="FitLayout">
             <Items>
                <ext:PolarChart ID="chartDestinations" runat="server" Animation="true" Shadow="true" Flex="1">
                   <Background Fill="#FFFFFF"></Background>
                   <LegendConfig runat="server" Dock="Right" BoxStrokeWidth="0" />
                   <Store>
                      <ext:Store ID="storeDestinations" runat="server">
                         <Model>
                            <ext:Model ID="Model1" runat="server">
                               <Fields>
                                  <ext:ModelField Name="Destination"></ext:ModelField>
                                  <ext:ModelField Name="Calls"></ext:ModelField>
                               </Fields>
                            </ext:Model>
                         </Model>
                      </ext:Store>
                   </Store>
                   <Interactions>
                      <ext:RotatePie3DInteraction />
                   </Interactions>
                   <Series>
                      <ext:Pie3DSeries Donut="40" AngleField="Calls" ShowInLegend="true" Highlight="true" Colors="#94AE0A,#115FA6,#A61120,#FF8809,#FFD13E,#A61187,#24AD9A,#7C7474,#A66111,#222222">
                         <Label Field="Destination" Display="Rotate" Font="16px Arial">
                            <Renderer Handler="return '';"></Renderer>
                         </Label>
                         <Tooltip ID="Tips1" TrackMouse="true" runat="server" Width="220" Height="28">
                            <Renderer Handler="toolTip.setHtml(record.get('Destination') + ': ' + record.get('Calls'));"></Renderer>
                         </Tooltip>
                         <Listeners>
                            <ItemClick Handler="alert('ItemClick');"></ItemClick>
                         </Listeners>
                      </ext:Pie3DSeries>
                   </Series>
                   <Plugins>
                      <ext:ChartItemEvents runat="server" />
                   </Plugins>
                </ext:PolarChart>
             </Items>
          </ext:Panel>
       </form>
    </body>
    </html>
    Last edited by fabricio.murta; Sep 16, 2016 at 7:07 PM.
  2. #2
    Hello Edgar!

    I guess the best way to handle it would be tracking the mouse button down event and checking if, when the click event triggers, the position of the event trigger (mouse pointer) is the same.

    This seemed to do the job in both chrome and firefox:

          var handleItemClick = function (series, item, e) {
              console.log('up:'+e.xy[0] + ',' + e.xy[1]);
              if (this.mdownxy && this.mdownxy.length == 2) {
                  if (this.mdownxy[0] != e.xy[0] || this.mdownxy[1] != e.xy[1]) {
                      return false;
                  }
              }
              Ext.Msg.alert('pie3d event', 'Item click!');
          }
    
          var handleMDown = function (series, item, e) {
              console.log('dn:' + e.xy[0] + ',' + e.xy[1]);
              this.mdownxy = e.xy;
          }
    Have this script block somewhere in your code, and then set the events like this:

    <ItemClick Fn="handleItemClick" />
    <ItemMouseDown Fn="handleMDown" />
    Hope this helps! The problem is that seems the browsers seem to handle differently a drag or ordinary click event.
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Thanks FabrÃ*cio! It works now in Firefox.
  4. #4
    Thanks for the feedback, glad it worked for you!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. [CLOSED] Rotate object
    By Quico in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 29, 2013, 2:14 PM
  2. [CLOSED] i want to rotate small image
    By UT007 in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: May 06, 2013, 3:57 PM
  3. [CLOSED] Component image support rotate?
    By stoque in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jan 16, 2012, 11:00 AM
  4. How to rotate a grid column header?
    By AmitM in forum 1.x Help
    Replies: 11
    Last Post: Jun 08, 2011, 2:29 PM
  5. [CLOSED] [0.8.1] Rotate Ext.Image
    By cobiscorp in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Aug 19, 2010, 1:01 PM

Tags for this Thread

Posting Permissions