Sri Posted June 23, 2009 Report Share Posted June 23, 2009 Hi...All In Chart FX 7, there is a sample of realtimechart. I want to add dropdownlist to filtering the data chart. Any suggestion to do it? Thanks. Quote Link to comment Share on other sites More sharing options...
juanZ Posted June 24, 2009 Report Share Posted June 24, 2009 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. Quote Link to comment Share on other sites More sharing options...
Sri Posted June 26, 2009 Author Report Share Posted June 26, 2009 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 Quote Link to comment Share on other sites More sharing options...
juanZ Posted June 26, 2009 Report Share Posted June 26, 2009 Im sorry I posted the code on Java.... I will post it again for .Net. However, Chart FX cannot add new series dinamically. You can set a new dataset with new data (including old data) and re-bind it to the chart. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.