Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Nebula » swt xy-plot runs only on my pc(programm reads xy-textfile and cannot plot xy-graph except on any other PC with win 7 and same java version)
swt xy-plot runs only on my pc [message #1736140] Mon, 27 June 2016 06:17 Go to next message
stefan Ohm is currently offline stefan OhmFriend
Messages: 3
Registered: June 2016
Junior Member

import java.util.*;

import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;

import org.eclipse.core.*;
import org.eclipse.core.commands.*;
import org.eclipse.equinox.*;
import org.eclipse.osgi.*;
import org.eclipse.draw2d.*;
import org.eclipse.nebula.visualization.xygraph.*;
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.nebula.visualization.xygraph.dataprovider.CircularBufferDataProvider;
import org.eclipse.nebula.visualization.xygraph.figures.*;
import org.eclipse.nebula.visualization.xygraph.figures.Trace.PointStyle;
import org.eclipse.nebula.visualization.xygraph.figures.Trace.TraceType;
import org.eclipse.nebula.visualization.xygraph.util.XYGraphMediaFactory;
public class PlotKomp // wird von aufgerufen
Scanner scanAusgabe; // Um ausgabe.txt zu durchsuchen

public void drawGraph()
File ausgabe = new File("D:\\ausgabe.txt");
int probenzahl =0;
//Scanner scanAusgabe;
// PlotKomp plotobj = new PlotKomp();
scanAusgabe = new Scanner(ausgabe);

}catch(IOException ausg)
{System.out.println("ausgabe.txt nicht gefunden");}

// So und nun die Ausgabefile von calc_minerals auslesen und die quotientenWerte in arraylists abspeichern.
ArrayList <String> arrlistsio2 = new ArrayList<String>();
ArrayList <String> arrlistsio2xrd = new ArrayList<String>();
ArrayList <String> arrlistsio2rfa = new ArrayList<String>();

String lineliste = scanAusgabe.nextLine();
if(lineliste.startsWith("limsnr")) // Fängt am Anfang von ausgabe.txt an, nur zum Zählen
probenzahl = probenzahl+1;
String[] sio2arr = lineliste.split("\\s+");
arrlistsio2.add(sio2arr[4]); // Quotient
arrlistsio2xrd.add(sio2arr[2]); // XRD
arrlistsio2rfa.add(sio2arr[3]); // XRF
} // Ende while(scanAusgabe.hasNextLine())

String[] arrsio2xrdstring = arrlistsio2xrd.toArray(new String[arrlistsio2xrd.size()]);
double[] arrsio2xrdend = new double[arrsio2xrdstring.length];

for(int g1= 0; g1 < arrsio2xrdend.length;g1++)
arrsio2xrdend[g1] = Double.parseDouble(arrsio2xrdstring[g1]);
String[] arrsio2rfastring = arrlistsio2rfa.toArray(new String[arrlistsio2rfa.size()]);
double[] arrsio2rfaend = new double[arrsio2rfastring.length];

for(int g1= 0; g1 < arrsio2rfaend.length;g1++)
arrsio2rfaend[g1] = Double.parseDouble(arrsio2rfastring[g1]);
//16.05.2016 System.out.println("im letzt sio2arr_xrf "+ arrsio2rfaend[g1]+" indexxx "+g1);
Display display = Display.getDefault();
Shell shell = new Shell(display);

shell.setSize(600, 450);;
// so verschiebt man am Ende den Plot
shell.setLocation(100, 100);
// Jetzt arraylists auslesen für die Graphik mit "essentials..."
LightweightSystem lwssio2 = new LightweightSystem(shell);

// create several new xy-graphs
XYGraph xysio2graph = new XYGraph();

// set it as content of LightWeightSystem

// Configure XYGraph

// Bezeichnung der Achsen
xysio2graph.primaryXAxis.setTitle("XRD-Value [%]");
xysio2graph.primaryYAxis.setTitle("XRF-Value [%]");

// Create a trace data provider, which will provide the data to the trace XRD and XRF
CircularBufferDataProvider tdpsio2 = new CircularBufferDataProvider(false);

// Create a trace data provider for the line

Trace tracesio2 = new Trace("SiO2-XY Plot", xysio2graph.primaryXAxis, xysio2graph.primaryYAxis, tdpsio2);
// set trace property (Messpunkte xrd - xrf)



CircularBufferDataProvider tdpsio2line = new CircularBufferDataProvider(false);
tdpsio2line.setCurrentXDataArray(new double[]{0.0, 50.0, 100.0});
tdpsio2line.setCurrentYDataArray(new double[]{0.0, 50.0, 100.0});

Trace tracesio2line = new Trace("SiO2-XY Plot", xysio2graph.primaryXAxis, xysio2graph.primaryYAxis, tdpsio2line);



} // Ende Mehtode drawkomp

public static void main(String[] args)
PlotKomp plotversuch = new PlotKomp();


The file ausgabe.txt has got the following Formate:

imsnr Komponente XRD XRF Quotient Kommentar

1504629 SiO2 53.18 50.17 1.05
1504629 TiO2 0.0 0.01 0.0
1504629 Al2O3 0.0 0.23 0.0
1504629 Fe2O3 38.21 38.32 0.99
1504629 MnO 0.0 0.06 0.0
1504629 MgO 0.0 2.63 0.0 no minerals for MgO
1504629 CaO 0.0 0.55 0.0 no minerals for CaO
1504629 Na2O 6.68 5.77 1.15 zu viel Na2O berechnet
1504629 K2O 0.0 0.06 0.0
1504629 P2O5 0.0 0.09 0.0
1504629 SO3 0.0 0.01 0.0
1504629 BaO 0.0 0.001 0.0

My Environment: PC hp, win 7, Java Version: 1.8.0_91, PC has got 64 bit operating System and processor: Intel(R) Core(TM) i5-4210 M
The program is developed on eclipse Luna

Does anyboy has any idea why this program does not run ?

Re: swt xy-plot runs only on my pc [message #1736187 is a reply to message #1736140] Mon, 27 June 2016 12:05 Go to previous messageGo to next message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 432
Registered: July 2009
Senior Member

Hi Stefan,

What do you mean does not run? Are there exceptions?

Also the title of your post does not match the content of the message.



[Updated on: Mon, 27 June 2016 12:07]

Report message to a moderator

Re: swt xy-plot runs only on my pc [message #1736404 is a reply to message #1736187] Wed, 29 June 2016 09:21 Go to previous messageGo to next message
stefan Ohm is currently offline stefan OhmFriend
Messages: 3
Registered: June 2016
Junior Member
Sorry, when starting the program from the DOS-emulated area Java -jar myfile.jar I got the message that I have got 32 bit JVM. This Problem of SWT with 32 bit and 64 bit is well known in the Forums!

So I installed JVM 64 Eclipse Neo and I tried to run the program, but what I got is
xysio2graph.primaryXAxis.setShowMajorGrid(true); with "primaryXAxis" striked through and the hint "The field XYGraph.primaryXAxis is deprecated" It happens when import org.eclipse.nebula.visualization.xygraph.figures.*;
How happened that ?
Is it necessary to open a new Topic or can we continue here ?
Re: swt xy-plot runs only on my pc [message #1736420 is a reply to message #1736404] Wed, 29 June 2016 11:16 Go to previous message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 432
Registered: July 2009
Senior Member

Hi Stefan,

> Is it necessary to open a new Topic or can we continue here ?

Neither. Please google that too.


Previous Topic:draw axial graph
Next Topic:[CDateTime] Setting a date with days before month
Goto Forum:

Current Time: Mon Nov 19 04:41:34 GMT 2018

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

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

Back to the top