Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » Nebula Visalization Widgets API (Proposed change to API)
Nebula Visalization Widgets API [message #1375426] Fri, 23 May 2014 02:30 Go to next message
Adrian G is currently offline Adrian GFriend
Messages: 1
Registered: May 2014
Junior Member
While using the visualization widgets API I stumbled accross some hurdles that limited my ability to utilize the xygraph in the way I wanted (multiple linked graphs in a SahForm). To implement as I wanted I modified the source to add more flexibility. The changes I made are discussed below and would welcome their consideration for implementation in the API.

Proposed modifications are divided into type 1 (backwards campatible) and type 2 (non backwards compatible) and are outlined below.

Type 1) compliant with applications that use the org.eclipse.nebula.visulaization plugin.

Created interfaces for all public methods for:
org.eclipse.nebula.visualization.xygraph.figures
Axis → IAxis
Legend → ILegend
XYGraph ->IXYGraph

org.eclipse.nebula.visualization.xygraph.linearscale
AbstractScale → IAbstractScale
LinearScale → ILinearScale

Other Code modifications:
org.eclipse.nebula.visualization.xygraph.figures
Axis Changed visibility of pan and zoomInOut methods to public so they could be added to the IAxis interface.
public void pan(final Range temp, double t1, double t2);
public void zoomInOut(final double center, final double factor);

Type 2) - creates incompatibility with applications that utilize the org.eclipse.nebula.visulaization plugin.

XYGraph - change.
final public IAxis primaryXAxis;
final public IAxis primaryYAxis;
to
private IAxis primaryXAxis;
private IAxis primaryYAxis;
and add getter/setters and add the getters/setters to IXYGraph (and concrete implementations).
public abstract IAxis getPrimaryXAxis();
public abstract void setPrimaryXAxis(IAxis primaryXAxis);
public abstract IAxis getPrimaryYAxis();
public abstract void setPrimaryYAxis(IAxis primaryYAxis);

All other classes that access the public fields to be changed to access the public getter (ie AddAnnotationDialog, AxisConfigPage, and all the examples!).

Rationale for interface extraction and code modification:

To allow me to create SWT-XY-Graph plots inside a SashForm, where an axis can be located in a child of the sashform and the plot itself can be in another child. This way I can have multiple plots that can be resized which all share a common axis.

I can understand if the type 1 changes only are considered, at least these will allow users more flexibility in implemation of the plugin.

I can attach/send the modified source code if required.

-Adrian
Re: Nebula Visalization Widgets API [message #1376824 is a reply to message #1375426] Fri, 23 May 2014 15:49 Go to previous messageGo to next message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 432
Registered: July 2009
Senior Member

Hello Adrian,

That looks like a great addition. Because of the EPL license there are some rules attached to accepting contributions. Please take a look at the Patches section of our contribution guide here [1]. After that, file a bug against Nebula/Visualization [2]. After discussion in the bug you need to put your contribution into our Gerrit code review system.

Best regards,

Wim

[1] https://wiki.eclipse.org/Nebula/Contributions
[2] https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Nebula&component=Visualization

Re: Nebula Visalization Widgets API [message #1694990 is a reply to message #1376824] Mon, 11 May 2015 09:08 Go to previous messageGo to next message
Alex Clayton is currently offline Alex ClaytonFriend
Messages: 8
Registered: February 2015
Junior Member
Sorry to resurrect an old thread, but I am encountering a similar problem to the one above.

In short I wish to add custom Axis to my graph. Specifically a sub class of Axis that provides specialised formatting for the labels.

This is difficult however, as the primary axes member variables (primaryXAxis and primaryYAxis) are final public variables which are set in the XYGraph constructor. As such if I subclass XYGraph I can't change the primary axes.

I see a couple of possible solutions:

1) Provide public accessor methods for the primary axes (i.e getPrimaryXAxis() and getPrimaryYAxis()) and modify all the code in the visualisation plugin (AddAnotationDialog, AccessConfigPage and the examples ) to use the new accessor methods. When XYGraph is then subclassed these methods can then be overwritten. To maintain compatibility with existing code however, the variables will have to be kept public and anyone who uses sub classes of XYGraph will have to know to use the accessor methods instead of accessing the variables directly.

2) A safer, but possibly larger, solution would be to provide an AxesFactory interface. This would be used by the XYGraph constructor to create the primary axes. A default one that produces the standard Axis would be provided and this would be the one the standard XYGraph() constructor would use. An alternative constructor for XYGraph would be added that takes a AxesFactory as an parameter, here the user could provide a custom factory that produces his own custom axes.

I could raise a bug and provide code for this if needed.

Alex Clayton
Re: Nebula Visalization Widgets API [message #1695912 is a reply to message #1694990] Wed, 20 May 2015 09:25 Go to previous message
Alex Clayton is currently offline Alex ClaytonFriend
Messages: 8
Registered: February 2015
Junior Member
I have now raised a bug for this - Bug 467676 - Allow use of custom axes in XYGraph

Previous Topic:[CDateTime] Focus issue
Next Topic:Gantt Widget 2.0 - Any Requests?
Goto Forum:
  


Current Time: Tue Nov 13 19:06:56 GMT 2018

Powered by FUDForum. Page generated in 0.02531 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top