本文整理汇总了Java中org.jfree.chart.renderer.xy.HighLowRenderer类的典型用法代码示例。如果您正苦于以下问题:Java HighLowRenderer类的具体用法?Java HighLowRenderer怎么用?Java HighLowRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HighLowRenderer类属于org.jfree.chart.renderer.xy包,在下文中一共展示了HighLowRenderer类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createHighLowChart
import org.jfree.chart.renderer.xy.HighLowRenderer; //导入依赖的package包/类
/**
* Creates and returns a default instance of a high-low-open-close chart.
*
* @param title the chart title (<code>null</code> permitted).
* @param timeAxisLabel a label for the time axis (<code>null</code> permitted).
* @param valueAxisLabel a label for the value axis (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
*
* @return a high-low-open-close chart.
*/
public static JFreeChart createHighLowChart(String title,
String timeAxisLabel,
String valueAxisLabel,
OHLCDataset dataset,
boolean legend) {
ValueAxis timeAxis = new DateAxis(timeAxisLabel);
NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
HighLowRenderer renderer = new HighLowRenderer();
renderer.setToolTipGenerator(new HighLowItemLabelGenerator());
XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
return chart;
}
示例2: createHighLowChart
import org.jfree.chart.renderer.xy.HighLowRenderer; //导入依赖的package包/类
/**
* Creates and returns a default instance of a high-low-open-close chart.
*
* @param title the chart title (<code>null</code> permitted).
* @param timeAxisLabel a label for the time axis (<code>null</code>
* permitted).
* @param valueAxisLabel a label for the value axis (<code>null</code>
* permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
*
* @return A high-low-open-close chart.
*/
public static JFreeChart createHighLowChart(String title,
String timeAxisLabel,
String valueAxisLabel,
OHLCDataset dataset,
boolean legend) {
ValueAxis timeAxis = new DateAxis(timeAxisLabel);
NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
HighLowRenderer renderer = new HighLowRenderer();
renderer.setBaseToolTipGenerator(new HighLowItemLabelGenerator());
XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
return chart;
}
示例3: createHighLowChart
import org.jfree.chart.renderer.xy.HighLowRenderer; //导入依赖的package包/类
/**
* Creates and returns a default instance of a high-low-open-close chart.
*
* @param title the chart title (<code>null</code> permitted).
* @param timeAxisLabel a label for the time axis (<code>null</code>
* permitted).
* @param valueAxisLabel a label for the value axis (<code>null</code>
* permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
*
* @return A high-low-open-close chart.
*/
public static JFreeChart createHighLowChart(String title,
String timeAxisLabel, String valueAxisLabel, OHLCDataset dataset,
boolean legend) {
ValueAxis timeAxis = new DateAxis(timeAxisLabel);
NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
HighLowRenderer renderer = new HighLowRenderer();
renderer.setBaseToolTipGenerator(new HighLowItemLabelGenerator());
XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
示例4: createHighLowChart
import org.jfree.chart.renderer.xy.HighLowRenderer; //导入依赖的package包/类
/**
* Creates and returns a default instance of a high-low-open-close chart.
*
* @param title the chart title ({@code null} permitted).
* @param timeAxisLabel a label for the time axis ({@code null}
* permitted).
* @param valueAxisLabel a label for the value axis ({@code null}
* permitted).
* @param dataset the dataset for the chart ({@code null} permitted).
* @param legend a flag specifying whether or not a legend is required.
*
* @return A high-low-open-close chart.
*/
public static JFreeChart createHighLowChart(String title,
String timeAxisLabel, String valueAxisLabel, OHLCDataset dataset,
boolean legend) {
ValueAxis timeAxis = new DateAxis(timeAxisLabel);
NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
HighLowRenderer renderer = new HighLowRenderer();
renderer.setDefaultToolTipGenerator(new HighLowItemLabelGenerator());
XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
示例5: createHighLowChart
import org.jfree.chart.renderer.xy.HighLowRenderer; //导入依赖的package包/类
/**
* Creates and returns a default instance of a high-low-open-close chart.
*
* @param title the chart title (<code>null</code> permitted).
* @param timeAxisLabel a label for the time axis (<code>null</code>
* permitted).
* @param valueAxisLabel a label for the value axis (<code>null</code>
* permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
*
* @return A high-low-open-close chart.
*/
public static JFreeChart createHighLowChart(String title,
String timeAxisLabel,
String valueAxisLabel,
OHLCDataset dataset,
boolean legend) {
ValueAxis timeAxis = new DateAxis(timeAxisLabel);
NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
HighLowRenderer renderer = new HighLowRenderer();
renderer.setBaseToolTipGenerator(new HighLowItemLabelGenerator());
XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, renderer);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
plot, legend);
currentTheme.apply(chart);
return chart;
}
示例6: testHashcode
import org.jfree.chart.renderer.xy.HighLowRenderer; //导入依赖的package包/类
/**
* Two objects that are equal are required to return the same hashCode.
*/
public void testHashcode() {
HighLowRenderer r1 = new HighLowRenderer();
HighLowRenderer r2 = new HighLowRenderer();
assertTrue(r1.equals(r2));
int h1 = r1.hashCode();
int h2 = r2.hashCode();
assertEquals(h1, h2);
}
示例7: testEquals
import org.jfree.chart.renderer.xy.HighLowRenderer; //导入依赖的package包/类
/**
* Check that the equals() method distinguishes all fields.
*/
public void testEquals() {
HighLowRenderer r1 = new HighLowRenderer();
HighLowRenderer r2 = new HighLowRenderer();
assertEquals(r1, r2);
// drawOpenTicks
r1.setDrawOpenTicks(false);
assertFalse(r1.equals(r2));
r2.setDrawOpenTicks(false);
assertTrue(r1.equals(r2));
// drawCloseTicks
r1.setDrawCloseTicks(false);
assertFalse(r1.equals(r2));
r2.setDrawCloseTicks(false);
assertTrue(r1.equals(r2));
// openTickPaint
r1.setOpenTickPaint(Color.red);
assertFalse(r1.equals(r2));
r2.setOpenTickPaint(Color.red);
assertTrue(r1.equals(r2));
// closeTickPaint
r1.setCloseTickPaint(Color.blue);
assertFalse(r1.equals(r2));
r2.setCloseTickPaint(Color.blue);
assertTrue(r1.equals(r2));
}
示例8: testEquals
import org.jfree.chart.renderer.xy.HighLowRenderer; //导入依赖的package包/类
/**
* Check that the equals() method distinguishes all fields.
*/
public void testEquals() {
HighLowRenderer r1 = new HighLowRenderer();
HighLowRenderer r2 = new HighLowRenderer();
assertEquals(r1, r2);
// drawOpenTicks
r1.setDrawOpenTicks(false);
assertFalse(r1.equals(r2));
r2.setDrawOpenTicks(false);
assertTrue(r1.equals(r2));
// drawCloseTicks
r1.setDrawCloseTicks(false);
assertFalse(r1.equals(r2));
r2.setDrawCloseTicks(false);
assertTrue(r1.equals(r2));
// openTickPaint
r1.setOpenTickPaint(Color.red);
assertFalse(r1.equals(r2));
r2.setOpenTickPaint(Color.red);
assertTrue(r1.equals(r2));
// closeTickPaint
r1.setCloseTickPaint(Color.blue);
assertFalse(r1.equals(r2));
r2.setCloseTickPaint(Color.blue);
assertTrue(r1.equals(r2));
// tickLength
r1.setTickLength(99.9);
assertFalse(r1.equals(r2));
r2.setTickLength(99.9);
assertTrue(r1.equals(r2));
}
示例9: testHashcode
import org.jfree.chart.renderer.xy.HighLowRenderer; //导入依赖的package包/类
/**
* Two objects that are equal are required to return the same hashCode.
*/
public void testHashcode() {
HighLowRenderer r1 = new HighLowRenderer();
HighLowRenderer r2 = new HighLowRenderer();
assertTrue(r1.equals(r2));
int h1 = r1.hashCode();
int h2 = r2.hashCode();
assertEquals(h1, h2);
}
示例10: test
import org.jfree.chart.renderer.xy.HighLowRenderer; //导入依赖的package包/类
@Override
public void test() {
super.test();
numberOfPagesTest(1);
JFreeChart chart = getChart("summary.chart1", 0);
XYItemRenderer renderer = chart.getXYPlot().getRenderer();
Assert.assertEquals("renderer", HighLowRenderer.class, renderer.getClass());
Assert.assertEquals("show open ticks", true, ((HighLowRenderer) renderer).getDrawOpenTicks());
Assert.assertEquals("show close ticks", true, ((HighLowRenderer) renderer).getDrawCloseTicks());
highLowChartDataTest(chart, 0, new Object[][] {
{"serie", date1, 50d, 35d, 40d, 47d, 70d}, {"serie", date2, 55d, 40d, 50d, 45d, 120d}, {"serie", date3, 48d, 41d, 42d, 47d, 90d}});
chart = getChart("summary.chart2", 0);
Axis axis = chart.getXYPlot().getDomainAxis();
Assert.assertEquals("category label", "time", axis.getLabel());
Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint());
Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());
Assert.assertTrue("vertical tick labels", ((ValueAxis) axis).isVerticalTickLabels());
chart = getChart("summary.chart3", 0);
axis = chart.getXYPlot().getRangeAxis();
Assert.assertEquals("value label", "value", axis.getLabel());
Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint());
Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10));
//Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());
Assert.assertEquals("range min value", 1d, ((ValueAxis) axis).getLowerBound());
Assert.assertEquals("range max value", 15d, ((ValueAxis) axis).getUpperBound());
Assert.assertTrue("vertical tick labels", ((ValueAxis) axis).isVerticalTickLabels());
}
示例11: testEquals
import org.jfree.chart.renderer.xy.HighLowRenderer; //导入依赖的package包/类
/**
* Problem that the equals(...) method distinguishes all fields.
*/
public void testEquals() {
HighLowRenderer r1 = new HighLowRenderer();
HighLowRenderer r2 = new HighLowRenderer();
assertEquals(r1, r2);
}
示例12: createHighLowChart
import org.jfree.chart.renderer.xy.HighLowRenderer; //导入依赖的package包/类
/**
*
* @param evaluation
* @throws JRException
*/
protected JFreeChart createHighLowChart() throws JRException
{
ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
JFreeChart jfreeChart =
ChartFactory.createHighLowChart(
evaluateTextExpression(getChart().getTitleExpression()),
evaluateTextExpression(((JRHighLowPlot)getPlot()).getTimeAxisLabelExpression()),
evaluateTextExpression(((JRHighLowPlot)getPlot()).getValueAxisLabelExpression()),
(DefaultHighLowDataset)getDataset(),
isShowLegend()
);
configureChart(jfreeChart, getPlot());
XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();
JRHighLowPlot highLowPlot = (JRHighLowPlot)getPlot();
HighLowRenderer hlRenderer = (HighLowRenderer) xyPlot.getRenderer();
boolean isShowOpenTicks = highLowPlot.getShowOpenTicks() == null ? false : highLowPlot.getShowOpenTicks().booleanValue();
boolean isShowCloseTicks = highLowPlot.getShowCloseTicks() == null ? false : highLowPlot.getShowCloseTicks().booleanValue();
hlRenderer.setDrawOpenTicks(isShowOpenTicks);
hlRenderer.setDrawCloseTicks(isShowCloseTicks);
// Handle the axis formating for the category axis
configureAxis(xyPlot.getDomainAxis(), highLowPlot.getTimeAxisLabelFont(),
highLowPlot.getTimeAxisLabelColor(), highLowPlot.getTimeAxisTickLabelFont(),
highLowPlot.getTimeAxisTickLabelColor(), highLowPlot.getTimeAxisTickLabelMask(), highLowPlot.getTimeAxisVerticalTickLabels(),
highLowPlot.getOwnTimeAxisLineColor(), false,
(Comparable<?>)evaluateExpression(highLowPlot.getDomainAxisMinValueExpression()),
(Comparable<?>)evaluateExpression(highLowPlot.getDomainAxisMaxValueExpression()));
// Handle the axis formating for the value axis
configureAxis(xyPlot.getRangeAxis(), highLowPlot.getValueAxisLabelFont(),
highLowPlot.getValueAxisLabelColor(), highLowPlot.getValueAxisTickLabelFont(),
highLowPlot.getValueAxisTickLabelColor(), highLowPlot.getValueAxisTickLabelMask(), highLowPlot.getValueAxisVerticalTickLabels(),
highLowPlot.getOwnValueAxisLineColor(), true,
(Comparable<?>)evaluateExpression(highLowPlot.getRangeAxisMinValueExpression()),
(Comparable<?>)evaluateExpression(highLowPlot.getRangeAxisMaxValueExpression()));
return jfreeChart;
}
示例13: createHighLowChart
import org.jfree.chart.renderer.xy.HighLowRenderer; //导入依赖的package包/类
/**
*
* @param evaluation
* @throws JRException
*/
protected JFreeChart createHighLowChart() throws JRException
{
ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
JFreeChart jfreeChart =
ChartFactory.createHighLowChart(
evaluateTextExpression(getChart().getTitleExpression()),
evaluateTextExpression(((JRHighLowPlot)getPlot()).getTimeAxisLabelExpression()),
evaluateTextExpression(((JRHighLowPlot)getPlot()).getValueAxisLabelExpression()),
(DefaultHighLowDataset)getDataset(),
isShowLegend()
);
configureChart(jfreeChart, getPlot());
XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();
JRHighLowPlot highLowPlot = (JRHighLowPlot)getPlot();
HighLowRenderer hlRenderer = (HighLowRenderer) xyPlot.getRenderer();
boolean isShowOpenTicks = highLowPlot.getShowOpenTicks() == null ? false : highLowPlot.getShowOpenTicks().booleanValue();
boolean isShowCloseTicks = highLowPlot.getShowCloseTicks() == null ? false : highLowPlot.getShowCloseTicks().booleanValue();
hlRenderer.setDrawOpenTicks(isShowOpenTicks);
hlRenderer.setDrawCloseTicks(isShowCloseTicks);
// Handle the axis formating for the category axis
configureAxis(xyPlot.getDomainAxis(), highLowPlot.getTimeAxisLabelFont(),
highLowPlot.getTimeAxisLabelColor(), highLowPlot.getTimeAxisTickLabelFont(),
highLowPlot.getTimeAxisTickLabelColor(), highLowPlot.getTimeAxisTickLabelMask(), highLowPlot.getTimeAxisVerticalTickLabels(),
highLowPlot.getOwnTimeAxisLineColor(), getDomainAxisSettings(),
(Comparable<?>)evaluateExpression(highLowPlot.getDomainAxisMinValueExpression()),
(Comparable<?>)evaluateExpression(highLowPlot.getDomainAxisMaxValueExpression())
);
// Handle the axis formating for the value axis
configureAxis(xyPlot.getRangeAxis(), highLowPlot.getValueAxisLabelFont(),
highLowPlot.getValueAxisLabelColor(), highLowPlot.getValueAxisTickLabelFont(),
highLowPlot.getValueAxisTickLabelColor(), highLowPlot.getValueAxisTickLabelMask(), highLowPlot.getValueAxisVerticalTickLabels(),
highLowPlot.getOwnValueAxisLineColor(), getRangeAxisSettings(),
(Comparable<?>)evaluateExpression(highLowPlot.getRangeAxisMinValueExpression()),
(Comparable<?>)evaluateExpression(highLowPlot.getRangeAxisMaxValueExpression())
);
return jfreeChart;
}
示例14: createHighLowChart
import org.jfree.chart.renderer.xy.HighLowRenderer; //导入依赖的package包/类
/**
*
*/
protected JFreeChart createHighLowChart() throws JRException
{
ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
JFreeChart jfreeChart =
ChartFactory.createHighLowChart(
evaluateTextExpression(getChart().getTitleExpression()),
evaluateTextExpression(((JRHighLowPlot)getPlot()).getTimeAxisLabelExpression()),
evaluateTextExpression(((JRHighLowPlot)getPlot()).getValueAxisLabelExpression()),
(DefaultHighLowDataset)getDataset(),
isShowLegend()
);
configureChart(jfreeChart);
XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();
JRHighLowPlot highLowPlot = (JRHighLowPlot)getPlot();
HighLowRenderer hlRenderer = (HighLowRenderer) xyPlot.getRenderer();
boolean isShowOpenTicks = highLowPlot.getShowOpenTicks() == null ? false : highLowPlot.getShowOpenTicks().booleanValue();
boolean isShowCloseTicks = highLowPlot.getShowCloseTicks() == null ? false : highLowPlot.getShowCloseTicks().booleanValue();
hlRenderer.setDrawOpenTicks(isShowOpenTicks);
hlRenderer.setDrawCloseTicks(isShowCloseTicks);
// Handle the axis formating for the category axis
configureAxis(xyPlot.getDomainAxis(), highLowPlot.getTimeAxisLabelFont(),
highLowPlot.getTimeAxisLabelColor(), highLowPlot.getTimeAxisTickLabelFont(),
highLowPlot.getTimeAxisTickLabelColor(), highLowPlot.getTimeAxisTickLabelMask(), highLowPlot.getTimeAxisVerticalTickLabels(),
highLowPlot.getTimeAxisLineColor(), false,
(Comparable<?>)evaluateExpression(highLowPlot.getDomainAxisMinValueExpression()),
(Comparable<?>)evaluateExpression(highLowPlot.getDomainAxisMaxValueExpression()));
// Handle the axis formating for the value axis
configureAxis(xyPlot.getRangeAxis(), highLowPlot.getValueAxisLabelFont(),
highLowPlot.getValueAxisLabelColor(), highLowPlot.getValueAxisTickLabelFont(),
highLowPlot.getValueAxisTickLabelColor(), highLowPlot.getValueAxisTickLabelMask(), highLowPlot.getValueAxisVerticalTickLabels(),
highLowPlot.getValueAxisLineColor(), true,
(Comparable<?>)evaluateExpression(highLowPlot.getRangeAxisMinValueExpression()),
(Comparable<?>)evaluateExpression(highLowPlot.getRangeAxisMaxValueExpression()));
return jfreeChart;
}