java - JavaFX LineChart showing right result in one computer and wrong in other -
so, we're doing home assignment in java , ui used javafx. program works, draws linechart charm , no problem. when classmate did same thing, didn't. dude sent me code, ran , in computer fine. cause - linechart showing wrong in 1 computer , right in other?
the data added chart in same way, in computer data shown in way it's entered chart in computer it's in wrong order (the elements sorted reason).
public linechart createchart(arraylist elements) throws polevalituderind{ //elements entered or chosen, in right order! arraylist fixedlst = new arraylist(); int s = 0; (int = 0; i<elements.size();i++){ s = (int) elements.get(i); fixedlst.add(s); } string strstart = tf2.gettext(); int intstart = 0; try { intstart = integer.parseint(strstart); } catch (numberformatexception j){ throw new polevalituderind(); } final numberaxis xaxis = new numberaxis(); final numberaxis yaxis = new numberaxis(); final linechart<number,number> linechart = new linechart<number,number>(xaxis,yaxis); xychart.series series = new xychart.series(); series.setname("radade vahetus"); //populating series data series.getdata().add(new xychart.data(intstart,0)); int counter = 1; (int j = 0;j<fixedlst.size();j++){ series.getdata().add(new xychart.data(fixedlst.get(j),counter)); counter += 1; } //system.out.println(series.getdata()); linechart.getdata().add(series); linechart.setmaxheight(150); return linechart; }
Comments
Post a Comment