我正在尝试使用GroovyChart API来构建图表,以显示使用Jenkins和SonarQube的分析版本之间的代码质量进度,并通过邮件发送它们。 在创建者提供的代码下方
import java.awt.BorderLayout as BL
//import com.thecoderscorner.groovychart.chart.ChartBuilder
import groovy.swing.SwingBuilder
import java.awt.Color
import java.awt.Font
import javax.swing.JFrame
import org.jfree.chart.ChartPanel
import org.jfree.chart.labels.PieToolTipGenerator
classLoader = ClassLoader.getSystemClassLoader()
classLoader.addURL(new File ("/var/lib/jenkins/libs/groovychart-0.1-SNAPSHOT.jar").toURL())
classLoader.addURL(new File ("/var/lib/jenkins/libs/jcommon-1.0.23.jar").toURL())
classLoader.addURL(new File ("/var/lib/jenkins/libs/jfreechart-1.0.19.jar").toURL())
classLoader.addURL(new File ("/var/lib/jenkins/libs/groovy-2.4.15.jar").toURL())
def largeFont = new Font("Arial", Font.BOLD, 15);
def cb = Class.forName("com.thecoderscorner.groovychart.chart.ChartBuilder").newInstance()
//ChartBuilder cb = new ChartBuilder();
def pieChart = cb.piechart3d(title: "Simple Pie Chart") {
defaultPieDataset {
Series1(40.0f)
Series2(30.0f)
Series3(30.0f)
}
antiAlias true
backgroundPaint(Color.WHITE)
pieplot {
sectionOutlinesVisible false
labelFont largeFont
labelGap 0.02
toolTipGenerator ({ dataset, key -> return "[${dataset} ${key}]" as String } as PieToolTipGenerator)
sectionPaint('Series1', paint: new Color(255,0,0))
sectionPaint('Series2', paint: new Color(0,255,0))
sectionPaint('Series3', paint: new Color(0,0,255))
}
}
def sb = new SwingBuilder()
def fr = sb.frame( title : 'Simple Pie Chart', size:[600, 400], defaultCloseOperation: JFrame.EXIT_ON_CLOSE) {
widget(new ChartPanel(pieChart.chart), constraints: BL.CENTER)
}
fr.pack();
fr.show();
编译代码时,出现此错误:
groovy.lang.MissingMethodException: No signature of method: com.thecoderscorner.groovychart.chart.ChartBuilder.piechart3d() is applicable for argument types: (java.util.LinkedHashMap, Script1$_run_closure1) values: [[title:Simple Pie Chart], Script1$_run_closure1@77c0dfd0]
请问有人有主意吗?
先谢谢您