jfreechart 数据点显示消息0点显示为上午12点,12点显示为下午12点
来源:互联网 发布:php 判断是否二维数组 编辑:程序博客网 时间:2024/03/29 09:23
jfreechart 当鼠标放在数据点时,提示信息中,0点显示为上午12点,12点显示为下午12点,请用过jfreechart的大侠指点迷津,谢谢了。
RealTimeWangYa ry = new RealTimeWangYa();
List list = ry.getList(powersupplyarm.split(",")[0], powersupplyarm
.split(",")[1], mindate, maxdate);
final TimeSeries series = new TimeSeries("网压曲线", Second.class);
Font font = new Font("宋体", Font.BOLD, 12);
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// TimeZone zone=TimeZone.getTimeZone("GMT+8"); //获取中国时区
//TimeZone.setDefault(zone); //设置时区
for (int i = 0; i < list.size(); i++) {
List info = (List) list.get(i);
series.addOrUpdate(
new Second(df.parse(info.get(5).toString())), Double
.parseDouble(info.get(7).toString()));
}
final TimeSeriesCollection dataset = new TimeSeriesCollection(
series);
final String chartTitle = "网压";
final JFreeChart chart = ChartFactory.createTimeSeriesChart(
chartTitle, "时间", "网压", dataset, true, true, false);
TextTitle title1 = new TextTitle("", font);//副标题
chart.setTitle(title1); //标题
final XYPlot plot = chart.getXYPlot();
XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) plot
.getRenderer();
xylineandshaperenderer.setSeriesPaint(0, new Color(0, 0, 255));
{
//显示曲线点上的数值
//xylineandshaperenderer.setItemLabelsVisible(true);
//xylineandshaperenderer.setBaseItemLabelsVisible(true);
//DecimalFormat f1=new DecimalFormat("##");
//xylineandshaperenderer.setItemLabelGenerator(new StandardXYItemLabelGenerator("{2}",f1,f1));
//xylineandshaperenderer.setPositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT));
//xylineandshaperenderer.setItemLabelFont(new Font("Dialog", 1, 8));
//plot.setRenderer(xylineandshaperenderer);
}
plot.setBackgroundPaint(Color.white);//设置网格背景颜色
plot.setDomainGridlinePaint(Color.pink);//设置网格竖线颜色
plot.setRangeGridlinePaint(Color.pink);//设置网格横线颜色
plot.setAxisOffset(new RectangleInsets(0D, 0D, 0D, 10D));//设置曲线图与xy轴的距离,即曲线与xy轴贴近的距离
//xylineandshaperenderer.setBaseShapesVisible(true);//设置曲线是否显示数据点
//plot.getDomainAxis().setLabelGenerator(new CategoryLabelGenerator());
plot.getDomainAxis().setLabelFont(font);//设置横坐标中文乱码
plot.getRangeAxis().setLabelFont(font);//y轴注释字体
// plot.getRangeAxis().setAutoRangeMinimumSize(18700.0); //设置Y轴的最小值
plot.setNoDataMessageFont(font);
final Marker marker_min = new ValueMarker(18700.0);
marker_min.setPaint(Color.RED);
marker_min.setAlpha(1.0f);
final Marker marker = new ValueMarker(29300.0);
marker.setPaint(Color.RED);
marker.setAlpha(1.0f);
plot.addRangeMarker(marker_min);
plot.addRangeMarker(marker);
plot.setBackgroundPaint(null);
// plot.setBackgroundImage(JFreeChart.INFO.getLogo());
chart.getLegend().setItemFont(font);
StandardEntityCollection sec = new StandardEntityCollection();
ChartRenderingInfo info = new ChartRenderingInfo(sec);
PrintWriter w = new PrintWriter(out);//输出MAP信息
String filename = ServletUtilities.saveChartAsJPEG(chart, 1024,
670, info, session);
ChartUtilities.writeImageMap(w, "map0", info, false);
String graphURL = request.getContextPath()
+ "/train/wangya?filename=" + filename;
String strimg = ChartUtilities.getImageMap(filename, info);
- jfreechart 数据点显示消息0点显示为上午12点,12点显示为下午12点
- Jfreechart显示数据点图表(线上可以显示点数据)
- Jfreechart生成曲线图数据点显示数据值
- jfreechart折线图如何在折点旁显示折点数据
- jfreechart+sql实现时间曲线图(显示曲线数据点)
- 动态取点显示
- 显示一个点
- Openlayers 显示坐标点
- Tabbar显示红点
- 显示llandmark点
- osg显示点云
- Tabbar显示红点
- osg显示点云
- OpenLayers4叠加显示点
- 显示定位蓝点
- 点云显示函数
- PageIndicatorView底部点显示
- datetime 时间 显示的是12小时的 下午1点显示的就是1 不是13
- LCD应用
- 微软、google、雅虎、百度等各大著名公司的经典面试题!保证搞晕你!!
- LCD应用
- struts2 FilterDispatcher 和 StrutsPrepareAndExecuteFilter 的区别
- struct sock结构的简单注释
- jfreechart 数据点显示消息0点显示为上午12点,12点显示为下午12点
- auto_ptr详解
- 一个用CSS实现隔行变色的技术
- Windows下openVPN GUI的安装与配置
- lcd字符显示
- 太全了 项目 下载
- axis环境搭建和发布的简单入门例子
- 联想利泰的一道做出来就给月薪7K的面试题--交通灯管理系统
- 使用二叉树排序