我最近开始使用JFreeChart并且有一些我想做的事情,但我不确定它是否可行.我的程序应该从wav文件中绘制谱图(声音图).所以我设法从我的wav文件中获取双arraylist中的数据并将其显示在图表中.但现在我希望能够选择我的频谱图区域(使用相同的缩放工具)而不进行缩放,并且只能播放我声音中的所选部分.但我根本找不到任何成功的方法.这是我的图表代码:
package classes;
import java.awt.Color;
import java.awt.Paint;
import java.awt.Rectangle;
import java.io.File;
import java.io.IOException;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.Plot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.XYPlot;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import org.jfree.ui.RectangleInsets;
public class Chart{
JFreeChart chart;
Plot plot;
//Constructeur de la classe Chart
public Chart(double[][] bs, int channel, int framesLength, float frameRate)
{
// Création d'un XY chart
XYSeries series = new XYSeries("XYGraph");
int i=0,j=0;
float k=0;
//Ajout de tous les points du tableau de 16 bytes dans le chart …Run Code Online (Sandbox Code Playgroud) 我想知道是否可以在轴描述中使用下标.我有以下代码
XYItemRenderer lineYY = new StandardXYItemRenderer();
lineYY.setSeriesPaint(0, Color.BLUE);
lineYY.setSeriesVisibleInLegend(0,false);
final NumberAxis yaxY = new NumberAxis("ax [m/s²]");
yaxY.setRange(-11, 11);
yaxY.setAutoRangeIncludesZero(false);
XYPlot plotYY = new XYPlot(datasetY,null,yaxY, lineYY);
plotYY.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
Run Code Online (Sandbox Code Playgroud)
有没有办法在字符串"a x [m /s²]"中下标x ?下标将是例如X₉
我想补充JFreeChart到JPanel,然后添加JPanel到JTabbedPane.我设法显示JFreeChart上JFrame,但我想添加JFreeChart为一个4片JTabbedPane.
代码显示图表:
public class Chart extends javax.swing.JPanel {
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
JPanel jPanel1 = new JPanel();
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.setValue(60, "Marks", "Student 1");
dataset.setValue(40, "Marks", "Student 2");
dataset.setValue(90, "Marks", "Student 3");
dataset.setValue(50, "Marks", "Student 4");
dataset.setValue(70, "Marks", "Student 5");
dataset.setValue(30, "Marks", "Student 6");
JFreeChart chart = ChartFactory.createBarChart(
"Student Marks", "Student Name", "Marks", dataset,
PlotOrientation.VERTICAL, false, true, false);
CategoryPlot p = …Run Code Online (Sandbox Code Playgroud)