Document or guide needed for creatine new Chart Types

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
jeet_sen
Posts: 8
Joined: Tue May 30, 2006 10:42 am
Location: Bangalore,India
Contact:

Document or guide needed for creatine new Chart Types

Post by jeet_sen » Wed Jun 28, 2006 8:17 am

Hi All,
I want to create a timing diagram extending JFreeChart. Can anyone refer me to any document or guide which can help me in doing so.
Also comment on how feasible it is to create a Timing Diagram using JFreeChart.

Regards,
Suvajit
Regards,
Suvajit Sengupta
Texas Instruments India

pmarsollier
Posts: 49
Joined: Thu Jul 08, 2004 8:54 am
Location: France

Post by pmarsollier » Wed Jun 28, 2006 10:27 am

as with any opensource projet, the ultimate doc is .. the code !

It's enought for the average java developer to understand how it works.

Depending what you wanna do, you'll need just extending an existing class, but more often, you need cloning and customizing a class.

jeet_sen
Posts: 8
Joined: Tue May 30, 2006 10:42 am
Location: Bangalore,India
Contact:

Post by jeet_sen » Wed Jun 28, 2006 2:06 pm

Yes, infact I am delving into code to do what I need.
But for my purpose, i.e generating a Timing Diagram is quite different from others as cannot be termed as a Chart.
In a chart all the Plots like Bar or Pie are similar for a given Chart , whereas a Timing diagram contains signals whcih are different from the other. Like a clock can be generated from afunction knowing the duty cycle and the period whereas a input or output signal we need to know (time:state) to draw the signal.
Will my reuqirment will fit into JFreeChart or not.
What do you say ?
Regards,
Suvajit Sengupta
Texas Instruments India

pmarsollier
Posts: 49
Joined: Thu Jul 08, 2004 8:54 am
Location: France

Post by pmarsollier » Wed Jun 28, 2006 2:08 pm

sorry, but i can't figure what you mean by Timing Diagram.

could post an example ?

jeet_sen
Posts: 8
Joined: Tue May 30, 2006 10:42 am
Location: Bangalore,India
Contact:

Post by jeet_sen » Thu Jun 29, 2006 5:28 am

If you are of digital seqeuential circuits, their behavior is depicted through a diagram displaying state of each signal against time scale ; that is timing diagram .Timing Diagram is not a chart.
Regards,
Suvajit Sengupta
Texas Instruments India

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Fri Jun 30, 2006 11:50 am

Are the images on the right side of the following page the type of thing you mean?

http://en.wikipedia.org/wiki/Logic_analyzer

Implementing this type of thing in JFreeChart would be possible, but a fair amount of work to do it properly.

Step one is to specify the minimum interface required to represent the dataset for such diagrams. The dataset would need to supply all the information about the state at any point in time for an arbitrary number of data series.

Step 2 is to create a new plot type. This just needs a time axis, and the ability to stack an arbitrary number of data series on top of each other along a sort of "category axis". I think it would make sense to factor out a "renderer" interface, to allow the datasets to be rendered in different ways...that becomes Step 3.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

jeet_sen
Posts: 8
Joined: Tue May 30, 2006 10:42 am
Location: Bangalore,India
Contact:

Post by jeet_sen » Fri Jun 30, 2006 12:00 pm

Hi David,
Yes, I have started the same way and your suggestion assures that I am on right track. Actuallly I am in the process of the defining the following for Timing diagrams :
1. Timing Diagram dataset
2. Timing Diagram Plot
and
3. Timing Diagram Renderer

Hope, if I can define these and put them together a to work in, JFreechart can boast to be used for timing diagrams also. It can also prove very useful for digital circuit designers.
Regards,
Suvajit Sengupta
Texas Instruments India

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Fri Jun 30, 2006 12:05 pm

Keep me posted on your progress. I have the feeling that this plot type (which displays state (or changes in state) through time for N series) could be made quite generic, and could even be reused for a more flexible Gantt chart than what we currently have.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

jeet_sen
Posts: 8
Joined: Tue May 30, 2006 10:42 am
Location: Bangalore,India
Contact:

Post by jeet_sen » Mon Jul 17, 2006 7:24 am

Hi All,
I have been able to define the renderer and basic dataset for displaying digital signals.
But now I am stuck with defining the timeline axis and label axis against the signals. Can you give me some cue point from where I can start extending the axis to define a domain axis (x axis) such that I can define time scale for nano second, micro second, milli sec. X axis is zoomable . Wheras the range axis(y axis) values are only labels denoting the signal name, hence not zoomable.
The dataset I have extended as Category dataset.
Regards,
Suvajit Sengupta
Texas Instruments India

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Tue Jul 18, 2006 11:22 am

For consistency with the other plots in JFreeChart, you want the domain axis (or x-axis) to be the one that shows the signal names (you ought to be able to reuse or adapt the CategoryAxis class for this). An d the range axis (or y-axis) should be zoomable and show the timing values (a DateAxis would do this, except that it doesn't support a resolution below milliseconds).

You can use the plot orientation setting to "rotate" the chart so that the range axis is horizontal, if that's what you require.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

jeet_sen
Posts: 8
Joined: Tue May 30, 2006 10:42 am
Location: Bangalore,India
Contact:

Post by jeet_sen » Tue Jul 18, 2006 11:40 am

HI David,
Thanks for the reply.
The details of what I am using for Waveform viewer are as follows:
A. Axes :
- CategoryAxis for Y Axis
( This axis wont zoom; similar to GanttChart Domain axis)
- NumberAxis for X Axis
[ o DateAxis cannot be used since it cannot go below millisecond
o Used NumberAxis for it ]
B. Renderer :
- Defined new Rendering Class SignalRenderer from AbstractCategoryItemRenderer
( Since clock signal rendering and data signal rendering are different extended them from SignalRenderer to define ClockSignalRenderer and DataSignalRenderer)

C. Plot :
- Extended from CategoryPlot to define SignalPlot

I have used NumberAxis for X Axis and extended CategoryPlot for plot .
But CategoryPlot is not compatible for NumberAxis but for ValueAxis.
What can be a feasible solution ?
Regards,
Suvajit Sengupta
Texas Instruments India

forsey85
Posts: 17
Joined: Mon Jul 03, 2006 2:55 pm

Post by forsey85 » Tue Jul 18, 2006 12:49 pm

NumberAxis is a subclass of ValueAxis.

You should be fine I think

jeet_sen
Posts: 8
Joined: Tue May 30, 2006 10:42 am
Location: Bangalore,India
Contact:

Post by jeet_sen » Fri Jul 21, 2006 6:55 am

HI David,
Axis problem is solved. Thanks for the help. Now can you throw some light on a new iproblem I am facing.
A signal can have a list of transitions (either high(H) or low(L)) at a given time. Hence, a transition can be defined as T(t,s) where,
t = time at which the transition occured (number) and
s = state of signal after transition (enumerated value ; either H or L )
For this I have defined a new SignalDataset interface extending from CategoryDataset. I am tabulating my dataset as follows :
Col --------> 0 1 N
Row Signal\Transition | transition1 | transition2 | .............. | transition N
--------------------------------------------------------------------------------
0 SIG1 | (1,H) | (3,L) | ............. | (100,L)
1 SIG2 | (2,H) | (3,L) | ............. | (100,L)
2 SIG3 | (0,H) | (1,L) | ............. | (100,H)
:::::::::::::::

Hence , for e,g dataset.getValue(0,0) will return me (1,H) .. and object of type Transition.
As I am implementing interface CategoryDataset, the prototype for getValue is :
Number getValue(int row, int col)
wheras prototype for my getValue is :
Transition getValue(int row, int col)
and for my case there is no implementation for the getValue defined in KeyedValues2D interface.
The only solution for this is to define a dummy Number getValue(int row, int col) which will not be used. But can you suggest any other clean solution.

Regards,
Suvajit
Regards,
Suvajit Sengupta
Texas Instruments India

Locked