Grails JFreeChart无法解析类:org.jfree.chart.ChartFactory
我正在运行一个程序,使用JFreeChart库和Groovy/Grails后端绘制折线图。这是我的密码:Grails JFreeChart无法解析类:org.jfree.chart.ChartFactory,grails,groovy,import,jfreechart,Grails,Groovy,Import,Jfreechart,我正在运行一个程序,使用JFreeChart库和Groovy/Grails后端绘制折线图。这是我的密码: package com.xyz.jfreechartdemo import org.jfree.chart.ChartFactory import org.jfree.chart.JFreeChart import org.jfree.chart.plot.PlotOrientation import org.jfree.data.category.
package com.xyz.jfreechartdemo
import org.jfree.chart.ChartFactory
import org.jfree.chart.JFreeChart
import org.jfree.chart.plot.PlotOrientation
import org.jfree.data.category.DefaultCategoryDataset
class JFreeChartSample {
def getChart(){
def dataset = createDataset()
def chart = createChart(dataset)
return chart
}
def createDataset() {
DefaultCategoryDataset dataset = new DefaultCategoryDataset()
dataset.addValue(2000,"X",1)
dataset.addValue(3300,"X",2)
dataset.addValue(2000,"X",3)
dataset.addValue(3300,"X",4)
return dataset
}
def createChart(dataset){
JFreeChart chart = ChartFactory.createLineChart("Widget not rendered","X","Count",dataset,PlotOrientation.VERTICAL,false,true,false)
return chart
}
}
我正在研究IntelliJ Idea 13.1.3。汇编成功。但我在运行程序时看到的是:
Compilation error: startup failed:
C:\Users\User\IdeaProjects\JFreeChartDemo\grails app\domain\com\xyz\jfreechartdemo\JFreeChartSample.groovy: 3: unable to resolve class org.jfree.chart.ChartFactory
@ line 3, column 1.
import org.jfree.chart.ChartFactory
^
C:\Users\User\IdeaProjects\JFreeChartDemo\grails-app\domain\com\xyz\jfreechartdemo\JFreeChartSample.groovy: 6: unable to resolve class org.jfree.data.category.DefaultCategoryDataset
@ line 6, column 1.
import org.jfree.data.category.DefaultCategoryDataset
^
C:\Users\User\IdeaProjects\JFreeChartDemo\grails-app\domain\com\xyz\jfreechartdemo\JFreeChartSample.groovy: 5: unable to resolve class org.jfree.chart.plot.PlotOrientation
@ line 5, column 1.
import org.jfree.chart.plot.PlotOrientation
^
C:\Users\User\IdeaProjects\JFreeChartDemo\grails-app\domain\com\xyz\jfreechartdemo\JFreeChartSample.groovy: 4: unable to resolve class org.jfree.chart.JFreeChart
@ line 4, column 1.
import org.jfree.chart.JFreeChart
^
4 errors
我已经将JCommon和所有JFreeChart库复制到lib文件夹中。我仍然看到这个错误。请帮忙。我对Groovy和Grails非常陌生。添加代码的步骤: