Jump to content
Software FX Community

.Net client control events not firing [Take 2]


MJ27

Recommended Posts

 Hi All,

 

There was a previous post ( .Net client control events not firing ) on this topic.

There where basically two options suggested:

1. Event can be handled on the client side

2. Event can be handled on the server side

I have taken the second approach, and I am stuck. 

I am trying to implement simple command in the series context menu, and I want to process the event on server side.

I have attached a simple project with this post.

Could anybody please point to me what I am doing wrong?

 

Could anybody shed some light on the SFX callback architecture of ChartFX?

 

Thanks in advance.

 

Regards,

MJ

Link to comment
Share on other sites

 Hi,

Hope this sample can help you to understand.

 

[ON THE ASPX PAGE]

<script language="javascript" type="text/javascript">

  // this function will invoke the server side in order to retrive data
  // so the chart can display data in real time.
  // enabled (true / false): boolean type
  // function returns nothing.
  function Feed1()
  {
  // Generate random number to display in chart
  // this number can also be generated in the server side.
  var randNum =Math.floor(Math.random()*10);
 
  // this callback will send the requesto to the server.
  // the UserCommand event in code behind will get this request.
  SFX_SendUserCallback('Chart1',randNum,false);
  }

 </script>

<body>
  <form id="form1" runat="server">
  <div>
  <input id="btnFeed1" type="button" value="Feed 1st Chart" onclick="Feed1();" />
  </div>
  <div>
  <chartfx7:Chart ID="Chart1" runat="server" RenderFormat=".Net"  UseCallbacksForEvents="true">
  </chartfx7:Chart>
  </div>
  </form>
</body>

 

[ON THE ASPX.CS Code Behind]

 [Load Method] Bind the event.

Chart1.UserCallback += new UserCallbackEventHandler(Chart1_UserCallback);

 // this will receive callback
  void Chart1_UserCallback(object sender, ChartFX.WebForms.UserCallbackEventArgs e)
  {

// Do Something to the Chart.

  }

 

I have a real time mode - concurrent callbacks sample of this. If you like, I can sent you the complete sample. you can write me back at support at softwarefx.com.

Link to comment
Share on other sites

 The method you are talking about works fine. The problem here is what if you want to do some work when the user zooms into the chart. I am talking about UserZoom and UserZooming events that are not triggered when renderformat=.NET

 If we have a client conrol (html - javascript) button that triggers a call back, it would not carry along the event arguments for the event (userzooming) that needs to be accessed. When the user zooms into a particular quadrant I would like to know how we can access the X and Y coordinates being viewed by the user at runtime. Hope I was clear.

Link to comment
Share on other sites

Hi,

In order to capture these coordinates you can use the UserZooming event which occurs after the user releases the zooming area selector and right before the chart is actually zoomed. This event will provide you (as event arguments) with the new Pixel coordinates of the chart. If you want to get the point coordinates (not pixel coordinates), you can use the PixelToValue method of the Axis class which converts a position in pixels in the chart area to its representation on the respective axis. A couple of things about Client-Side events: - UseClientLoader must be set to false - You must have Full Trust in your .NET permissions (Client Computer - .NET Framework 2.0 Configuration) in order for the client to send events to JavaScript. Take a look at the following sample:<script lang="JavaScript" for="Chart1" event="UserZooming(sender,args)"> alert('Pixel Coordinates: \n\nX1: ' + args.X1 +' and X2: '+ args.X2+ "\n" + 'Y1: ' + args.Y1 + ' and Y2: ' + args.Y2); var chx = document.getElementById("Chart1"); var x1 = chx.AxisX.PixelToValue(args.X1); var x2 = chx.AxisX.PixelToValue(args.X2); var y1 = chx.AxisY.PixelToValue(args.Y1); var y2 = chx.AxisY.PixelToValue(args.Y2); alert('Point Coordinates: \n\nX1: ' + x1 + ' and X2: ' + x2 + "\n" + 'Y1: ' + y1 + ' and Y2: ' + y2); </script> <form id="form1" runat="server"> <div> <chartfx7:Chart ID="Chart1" runat="server" RenderFormat=".Net" UseClientLoader="false" Width="729px"> <Series> <chartfx7:SeriesAttributes></chartfx7:SeriesAttributes> <chartfx7:SeriesAttributes></chartfx7:SeriesAttributes> <chartfx7:SeriesAttributes></chartfx7:SeriesAttributes> </Series> </chartfx7:Chart> </div> </form> </body> </html> Let me know if this is what you want to do. Hopefully this sample will help you. Regards, RandyJ

Link to comment
Share on other sites

 Hi Randy,

  I appreciate your timely response. The solution you have posted just about perfectly solves my problem. The code you have posted allows me to do my way of handling the chart once user selects the area to zoom in. That's great! 

 But there is one major issue I have run into now. Firefox is not rendering the chart as .NET client control. I completely understand that firefox does not support ActiveX control and that is what is causing the issue. But is there any other way to handle this. We dont want to lose our firefox users (who constitute about 50% of our users) and we dont want to force them to use IE instead. I want the charts to be interactive in both the browsers. We also have Mac users and am currently not sure what issues we'll run into there.

 Please let me know if you have any resolution for firefox.

Thanks Much!

Maz.

Link to comment
Share on other sites

Hi,

Unfortunately, due to the fact that firefox does not support ActiveX, you are not able to render the charts as .net clients. For firefox, you are only able to set the render format to "Image" or Auto (which will generate the most interactive format depending on the User Agent of the browser requesting the chart. If the browser is Internet Explorer with the .NET Framework installed, Chart FX will generate a .NET component. If the browser is Internet Explorer 4 or above, without the .NET Framework, an ActiveX will be generated. For the rest of the browsers, an image will be generated in Png or Jpeg format, depending on the browser's capabilities).

However, please note that Chart FX 7 takes advantage of the out of band callbacks capability and combines it with a powerful DHTML engine to produce chart images that allow full interactivity and support state in web applications.

Among other things, the Chart FX DHTML rendering engine allows developers to:

- Prevent downloading, configuration and use of ActiveX or .NET components making the application platform agnostic and maintenance free.

- Deploy charts that are fully secured as no binary files are needed in the browser.

- Access a fully interactive toolbar with drop-down menus that support most Chart FX end user functionality, including zooming and scrolling providing a much smoother client experience, while still maintaining the full flexibility of deploying to any browser client in the enterprise.

While the user is interacting with the chart, the Chart FX DHTML rendering engine will automatically update the chart with the new data. While this takes place, end users don't lose any of their chart settings, they don't get the appearance of a complete page refresh, and Internet Explorer didn't need to download the entire page content again; it only updated the one portion of the chart that changed.

Although you do not get exactly the same kind of interactivity when rendering images, you do get a lot of interactivity by means of the full advantage that Chart FX has taken of Ajax technologies.

Regards,

RandyJ

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...