天道酬勤,学无止境

chartpanel

JFreeChart 选择一个区域而不缩放(JFreeChart select an area without zooming)

问题 我最近开始使用 JFreeChart,我想做一些事情,但我不确定是否可行。 我的程序应该从 wav 文件中绘制频谱图(声音图)。 所以我设法从双数组列表中的 wav 文件中获取数据并将其显示在图表中。 但是现在我希望能够在不缩放的情况下选择我的频谱图的一个区域(使用用于缩放的相同工具),并且能够在我的声音中只播放选定的部分。 但我根本找不到任何成功的方法。 这是我的图表代码: 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

2021-06-10 03:09:15    分类:技术分享    java   zooming   jfreechart   area   chartpanel

JFreeChart select an area without zooming

I recently started using JFreeChart and there is something i would like to do but i'm not sure if it's possible. My program is supposed to draw a spectrogram (a sound graph) from a wav file. So i managed to get the data from my wav file in a double arraylist and to display it in a chart. But now i would like to be able to select an area of my spectrogram (with the same tool used for zooming) without zooming and to be able to play only the selected part on my sound. But i simply can't find any way to succeed. Here is my code of my chart: package classes; import java.awt.Color; import java.awt

2021-05-25 05:19:40    分类:问答    java   zooming   jfreechart   area   chartpanel

轴说明中的下标(Subscript in Axis description)

问题 我想知道是否可以在轴说明中使用下标。 我有以下代码 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); 是否可以在字符串“ a x [m /s²]”中对x下标? 下标为例如X₉ 回答1 使用此处显示的方法,可以为所需的轴标签指定AttributedString。 给定NumberAxis命名domain ,下面的示例使用TextAttribute值更改某些字符的SIZE和WEIGHT ,对第二个字符下标,并对指数上标。 String s = "ax [m/s2]"; AttributedString as = new

2021-05-08 03:46:16    分类:技术分享    java   jfreechart   subscription   chartpanel

Subscript in Axis description

I wanted to know if it is possible to use subscript in axis description. I have the following code 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); Is there a way to subscript the x in the String "ax [m/s²]"? An subscript would be e.g. X₉

2021-04-07 16:49:58    分类:问答    java   jfreechart   subscription   chartpanel

使用JPanel将ChartPanel添加到JTabbedPane(Adding ChartPanel to JTabbedPane using JPanel)

问题 我想将JFreeChart添加到JPanel ,然后将JPanel添加到JTabbedPane 。 我设法在JFrame上显示JFreeChart ,但我想将JFreeChart添加为JTabbedPane的第4个选项卡。 显示图表的代码: 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")

2021-04-06 16:30:36    分类:技术分享    java   charts   jfreechart   jtabbedpane   chartpanel

Adding ChartPanel to JTabbedPane using JPanel

I want to add JFreeChart to JPanel and then add JPanel to JTabbedPane. I managed to display JFreeChart on JFrame, but I want to add JFreeChart as a 4th tab of JTabbedPane. Code to display Chart: 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

2021-03-25 02:55:03    分类:问答    java   charts   jfreechart   jtabbedpane   chartpanel