Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Jfreechart: Can SymbolAxis work with TimeSeriesChart?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Currently I am using JfreeChart to create dynamic charts. Now am facing problem with XY chart. I want show some fixed string label names on Y axis and same time X axis have to fix with dynamic Date time values. How would I customize the X axis and Y axis. Here I have tried using TimeSeriesChart. Sample code here


  TimeSeries s1 = new TimeSeries("Encounter Summary");
   s1.add(new Year(2001), 181.8);
   s1.add(new Year(2002), 167.3);
   TimeSeriesCollection timeset = new TimeSeriesCollection();
   timeset.addSeries(s1);
   JFreeChart chart = ChartFactory.createTimeSeriesChart("Encounter Summary","Words",  "Activation", timeset, true,true,false);
   XYPlot plot = (XYPlot) chart.getPlot();
   String[] months =  new String[2];
   months[0] = "Jan";
   months[1] = "Feb";
   SymbolAxis rangeAxis = new SymbolAxis("Activation", months);
   rangeAxis.setTickUnit(new NumberTickUnit(1));
   rangeAxis.setRange(0,months.length);
   plot.setRangeAxis(rangeAxis);

When I tried above code i am able to see chart but not showing data line points in chart, When I commented SymbolAxis part its showing data points. I am suspecting SymbolAxis is not working with TimeSeries. When i used createXYLineChart instead of createTimeSeriesChart then succesfully showing data axis points in chart. Please help me to solve this problem.

Actually my requirement is Y axis fixed with month names Jan,Feb,Mar,Apr..Dec and same time X axis have to show dynamic data time values.

 
Let me tell you a story about a man named Jed. He made this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!