Jump to content
Software FX Community

filtering realtime chart


Sri
 Share

Recommended Posts

 Well, real time concept in Chart FX java 7 for desktop and Web applications is different. I'll supose that the real time implementation you looking for is by using Ajax or an asyncronous method to refresh chart.

 

this is a sample I made that makes a button hide a series of the chart. You can modify this sample at will. userCallbackEventHandler method will receive the request from the button (or in your case the drop down list).

 

<%@page import="com.softwarefx.chartfx.server.*"%><%@page contentType="text/html" pageEncoding="UTF-8"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html>   <head>   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">   <title>Javascript Sample : Chart FX 7 Server</title>   </head>   <script type="text/javascript">   function setVisible(iSeries) {   param=iSeries // this is the parameter sent from the button. (in your case the drop down list)   SFX_SendUserCallback('chart1',param ,false);   }   </script>   <body>   <%   ChartServer chart1 = new ChartServer(pageContext,request,response);   chart1.setID("chart1");   chart1.setWidth(600);   chart1.setHeight(400);   chart1.setUseCallbacksForEvents(true);   chart1.addUserCallbackListener(new UserCallBackEventHandler ());   chart1.renderControl();   %> <%!   public class UserCallBackEventHandler  implements UserCallbackListener   {   public void userCallbackEventHandler (UserCallbackEvent e)   {   ChartServer chart1 = (ChartServer)e.getSource();   String params = e.getParam();   chart1.getSeries().get(Integer.parseInt(params)).setVisible(false);   }   }   %>   <button OnClick="setVisible(0)">Serie1</button>   <button OnClick="setVisible(1)">Serie2</button>   <button OnClick="setVisible(2)">Serie3</button>   </body></html>

 

hope this helps.

Link to comment
Share on other sites

 Mr. Juan,

Thank you very much for your snipped code. It is very helpfull to me. In your snipped code, there are 3 series at the chart that loaded at first time the chart loaded. With onClick button event, we can choice one series from 3 series to visible.

If I want to add/subtract series by selected item event from dropdownlist, could you give to me any snipped code to do it? :)

Thanks.

Sri

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.

 Share

×
×
  • Create New...