Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to fill array list between 2 points?
    primarykey
    data
    text
    <p>i have this piece of code. To explain: </p> <p>The user inputs "initcores" data and "ttime" data (the "fcores" is a result). </p> <p>I want to fill the x array with values from 0 to ttime and the y from initcores to fcores and do the scatter plot ,x vs y. </p> <p>I have one problem :</p> <blockquote> <blockquote> <p>If i put " for (double t=0;t&lt;=fcores;t=t+fcores/10.0){ y.add(t); " </p> <p>it gives me a plot but its wrong. </p> <p>if i put " for (double t=initcores ;t&lt;=fcores;..." (which is right because we are starting from initcores) </p> <p>it doesn't appear anything in the plot. </p> </blockquote> </blockquote> <p>Am i not doing sth right here? </p> <p>Thank you!</p> <pre><code> ......... Double initcores= getInitcores(); Double fcores= getFcores(); Double ttime=getTime(); ArrayList&lt;Double&gt; x =new ArrayList&lt;Double&gt;(); ArrayList&lt;Double&gt; y =new ArrayList&lt;Double&gt;(); //fill x,y values for (double t=0;t&lt;=ttime;t+=ttime/10.0){ x.add(t); } for (double t=initcores;t&lt;=fcores;t+=fcores/10.0){ y.add(t); } TimeSeries series = new TimeSeries("Number of cores"); for (int i=0;i&lt;x.size();i++){ for (int j=0;j&lt;y.size();j++){ series.add(i,j); } } .......... </code></pre> <p>--------------EDIT --------------------------------------</p> <p>If i use :</p> <pre><code>double [] x = {0.0,ttime}; //time axis double [] y = {initcores,fcores}; //number of cores axis TimeSeries series = new TimeSeries("Number of cores"); for (int i=0;i&lt;x.length;i++){ series.add(x[i],y[i]); } </code></pre> <p>it gives me a plot with only 2 points.That's why i am trying to fill the points between them (for x axis :0-ttime ,for y axis:initcores-fcores).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload