java - JavaFX lineChart issue -
i have following code:
final treemap<integer, double> adlmap = new treemap<>(); public static void main(string[] args) { launch(args); } @override public void start(stage stage) { final string currency = "currreny"; adl(currency); stage.settitle("line chart sample"); //defining axes final numberaxis xaxis = new numberaxis(); final numberaxis yaxis = new numberaxis(); xaxis.setlabel("number of month"); //creating chart final linechart<number, number> linechart = new linechart<number, number>(xaxis, yaxis); linechart.settitle("stock monitoring, 2010"); //defining series xychart.series adlchart = new xychart.series(); xychart.series regularchart = new xychart.series(); adlchart.setname("my portfolio"); chartmap.entryset().foreach(entry -> regularchart.getdata().add(new xychart.data(entry.getkey(), entry.getvalue()))); //populating series data adlmap.entryset().foreach(entry -> adlchart.getdata().add(new xychart.data(entry.getkey(), entry.getvalue()))); system.out.println(adlmap); linechart.setcreatesymbols(false); scene scene = new scene(linechart, 1200, 1000); //linechart.getdata().add(regularchart); linechart.getdata().add(adlchart); stage.setscene(scene); stage.show(); final double scale_delta = 1.1; linechart.setonscroll(new eventhandler<scrollevent>() { public void handle(scrollevent event) { event.consume(); if (event.getdeltay() == 0) { return; } double scalefactor = (event.getdeltay() > 0) ? scale_delta : 1 / scale_delta; linechart.setscalex(linechart.getscalex() * scalefactor); linechart.setscaley(linechart.getscaley() * scalefactor); } }); linechart.setonmousepressed(new eventhandler<mouseevent>() { public void handle(mouseevent event) { if (event.getclickcount() == 2) { linechart.setscalex(1.0); linechart.setscaley(1.0); } } }); } private void adl(final string currency) { double counter = -4000000.0; int mapcounter = 0; while (counter < 4000000) { adlmap.put(mapcounter++, counter++); } }
the map contains following values: keys n+1 n€in values range -10.000.000 + 10.000.000
my problem: doesn't plot values @ all. @ least cannot see any.
can please help?
my mistake complex algorithm produced inifnity nuber placed in treemap. graph couldn't plot ofc.
Comments
Post a Comment