我正在尝试在折线图中绘制各种小值,但它不起作用。它只是一个很大的界限。
setSeries
功能
private void setSeries(){
XYChart.Series series = new XYChart.Series();
start = 0.01;
for (int i = 0; i < sounds.size(); i++) {
series.getData().add(new XYChart.Data<>(Math.sin(2.0*Math.PI*getFrequencyNote(sounds.get(i).Vol,notes.indexOf(sounds.get(i).Note))*start) + "", start));
System.out.println(Math.sin(2.0*Math.PI*getFrequencyNote(sounds.get(i).Vol,notes.indexOf(sounds.get(i).Note))*start));
start += 0.01;
}
SoundGraph.getData().add(series);
}
getFrequency
功能
private double value = Math.pow(2,1.0/12.0);
private double getFrequencyNote(double oct, double note){
return 440*Math.pow( value , (oct-4)*12 + (note - 10) );
}
之前未使用的LineChart SoundGraph。 “sounds”是我创建的类的列表,其中包含vol的double,而Note是一个字符串,但我只需要另一个列表的索引来使用getFrequency函数。
我正在使用Java SE 10,Javafx。结果如下:Image of the graphic
值
-0.8020843062860846,
0.9580268553320735,
0.9973557960766156,
-0.8446351001370388,
-0.9512778105761924,
0.1449623768717014,
-0.2301723191097895,
-0.9997705757517672,
-0.9894395527823209,
0.4887761842135673,
0.81474751877591,
-0.9849431403051101,
0.4495554901763745,
-0.3477891889816327,
0.1555506540644018,
0.7280882151244978,
0.11499335080804679,
0.4227021204675916,
0.9978519665255616,
0.9501664522040059,
-0.8731531393300894,
0.9983904297633855,
-0.9909331059657619,
0.6125702128979333,
-0.9570691237579619,
0.8950210873763147,
0.0017581396656234664,
0.6521553395245636,
-0.39306730640652926,
0.9992498113928694,
-0.11310002999268495,
-0.08557982614432237,
0.6444322301559682,
0.14807529636552533,
0.6309415311077592,
0.8671951169285017,
-0.6238825080225738,
-0.7256733664647849,
0.10651890266625182,
-0.9942696556523624,
-0.44641179085560256,
0.8512299966259365,
-0.7292922654748821,
-0.6190887279747803,
-0.7469772343384066,
-0.2662759469316001,
0.6796190835594168,
0.6403901381336917,
-0.9984885989706641,
0.9364223936822729,
-0.25576596448581923,
-0.48827388585839016,
-0.2818940265631654,
-0.0035162738966224957,
-0.9987958639647898,
0.9994748271680698,
-0.3872420445435474,
0.853566897318016,
0.9980774069098237,
0.5848859750411508,
-0.9588838044715969,
0.607557284685807