java - Drawing a dynamic graph that changes in real time -


i have code ..it prints real time tweets based on filter applied me , searches following sub strings in tweet, if there particular counter specific sub string gets incremented.

now , want draw graph taking these 2 counters input , showing real time variations.

please tell me api use or method can done.

statuslistener listener; listener = new statuslistener(){          int count1=0,count2=0; string s1="#rcb"; string s2="#kxip"; string s3="#rcb"; string s4="#kxip";         @override         public void onstatus(status status) {             t.append("\n" + status.getuser().getname() + " : " +      status.gettext() + "\n");             string str=status.gettext();              if(str.contains(s1)||str.contains(s3))                 count1++;             else if(str.contains(s2)||str.contains(s4))                 count2++;             t.append("count1:"+count1);             t.append("count2:"+count2);             defaultcategorydataset barchartdata=new                 defaultcategorydataset();             barchartdata.setvalue(count1,"popularity","rcb");             barchartdata.setvalue(count2,"popularity","kxip");             jfreechart barchart= chartfactory.createbarchart("popularity meter","teams", "popularity count", barchartdata, plotorientation.vertical, rootpanecheckingenabled, rootpanecheckingenabled, rootpanecheckingenabled);             categoryplot barchrt=barchart.getcategoryplot();             barchrt.setrangegridlinepaint(color.orange);             chartpanel barpanel= new chartpanel(barchart);             jpanel2.removeall();             jpanel2.add(barpanel,borderlayout.center);             jpanel2.validate();          } 

jfreechart popular java charting library:

http://www.jfree.org/jfreechart/

drive chart model, update model values, , tell chart model data has changed.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -