‘壹’ java web中怎么实现柱形图、饼状图等数据图
可以通过EXTJS,里面有控件,数据你可以从JSP后台获取,以前在存量房评估系统中就是使用这个绘制的,还不错。。
‘贰’ 前端如何实现立体饼图,柱状图,像下面这种
有很多插件的,当然你要是会用svg画也行,在工作中大部份人都是用插件,比如echarts,你可以去它的官网看看有没有你想要的柱状图行,然后改一改,应该也差不多了。
‘叁’ 这种条件下,如何做柱状图/饼状图
‘肆’ 用jsp怎样生成柱状图,饼状图,折线图
jsp生成柱状图,饼状图,折线图可以借助于jfreechart。
1、柱状图的生成源码:
/**
*生产柱状图
*@version1.0
*@since
*/
@SuppressWarnings("serial")
{
@Override
protectedvoidservice(HttpServletRequestrequest,
HttpServletResponseresponse)throwsServletException,IOException{
response.setContentType("text/html");
//使用普通数据集
=newDefaultCategoryDataset();
//增加测试数据,第一个参数是访问量,最后一个是时间,中间是显示用不考虑
chartDate.addValue(55,"访问量","2010-01");
chartDate.addValue(65,"访问量","2010-02");
chartDate.addValue(59,"访问量","2010-03");
chartDate.addValue(156,"访问量","2010-04");
chartDate.addValue(452,"访问量","2010-05");
chartDate.addValue(359,"访问量","2010-06");
try{
//从数据库中获得数据集
DefaultCategoryDatasetdata=chartDate;
//使用ChartFactory创建3D柱状图,不想使用3D,直接使用createBarChart
JFreeChartchart=ChartFactory.createBarChart3D(
"网站月访问量统计",//图表标题
"时间",//目录轴的显示标签
"访问量",//数值轴的显示标签
data,//数据集
PlotOrientation.VERTICAL,//图表方向,此处为垂直方向
//PlotOrientation.HORIZONTAL,//图表方向,此处为水平方向
true,//是否显示图例
true,//是否生成工具
false//是否生成URL链接
);
//设置整个图片的背景色
chart.setBackgroundPaint(Color.PINK);
//设置图片有边框
chart.setBorderVisible(true);
Fontkfont=newFont("宋体",Font.PLAIN,12);//底部
FonttitleFont=newFont("宋体",Font.BOLD,25);//图片标题
//图片标题
chart.setTitle(newTextTitle(chart.getTitle().getText(),titleFont));
//底部
chart.getLegend().setItemFont(kfont);
//得到坐标设置字体解决乱码
CategoryPlotcategoryplot=(CategoryPlot)chart.getPlot();
categoryplot.setDomainGridlinesVisible(true);
categoryplot.setRangeCrosshairVisible(true);
categoryplot.setRangeCrosshairPaint(Color.blue);
NumberAxisnumberaxis=(NumberAxis)categoryplot.getRangeAxis();
numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
BarRendererbarrenderer=(BarRenderer)categoryplot.getRenderer();
barrenderer.setBaseItemLabelFont(newFont("宋体",Font.PLAIN,12));
barrenderer.setSeriesItemLabelFont(1,newFont("宋体",Font.PLAIN,12));
CategoryAxisdomainAxis=categoryplot.getDomainAxis();
/*------设置X轴坐标上的文字-----------*/
domainAxis.setTickLabelFont(newFont("sans-serif",Font.PLAIN,11));
/*------设置X轴的标题文字------------*/
domainAxis.setLabelFont(newFont("宋体",Font.PLAIN,12));
/*------设置Y轴坐标上的文字-----------*/
numberaxis.setTickLabelFont(newFont("sans-serif",Font.PLAIN,12));
/*------设置Y轴的标题文字------------*/
numberaxis.setLabelFont(newFont("宋体",Font.PLAIN,12));
/*------这句代码解决了底部汉字乱码的问题-----------*/
chart.getLegend().setItemFont(newFont("宋体",Font.PLAIN,12));
//生成图片并输出
ChartUtilities.writeChartAsJPEG(response.getOutputStream(),1.0f,
chart,500,300,null);
}catch(Exceptione){
e.printStackTrace();
}
}
}
2、生成饼状统计图:
/**
*生成饼状统计图
*@version1.0
*@since
*/
@SuppressWarnings("serial")
{
protectedvoidservice(HttpServletRequestrequest,
HttpServletResponseresponse)throwsServletException,IOException{
response.setContentType("text/html");
//默认数据类型
DefaultPieDatasetdataType=newDefaultPieDataset();
//数据参数内容,数量
dataType.setValue("IE6",156);
dataType.setValue("IE7",230);
dataType.setValue("IE8",45);
dataType.setValue("火狐",640);
dataType.setValue("谷歌",245);
try{
DefaultPieDatasetdata=dataType;
//生成普通饼状图除掉3D即可
//生产3D饼状图
PiePlot3Dplot=newPiePlot3D(data);
JFreeChartchart=newJFreeChart(
"用户使用的浏览器类型",//图形标题
JFreeChart.DEFAULT_TITLE_FONT,//标题字体
plot,//图标标题对象
true//是否显示图例
);
//设置整个图片的背景色
chart.setBackgroundPaint(Color.PINK);
//设置图片有边框
chart.setBorderVisible(true);
//配置字体
Fontkfont=newFont("宋体",Font.PLAIN,12);//底部
FonttitleFont=newFont("宋体",Font.BOLD,25);//图片标题
//图片标题
chart.setTitle(newTextTitle(chart.getTitle().getText(),titleFont));
//底部
chart.getLegend().setItemFont(kfont);
ChartUtilities.writeChartAsJPEG(response.getOutputStream(),1.0f,
chart,500,300,null);
}catch(Exceptione){
e.printStackTrace();
}
}
}
3、柱状分布统计图:
/**
*柱状分布统计图
*@version1.0
*@since
*/
@SuppressWarnings("serial")
{
protectedvoidservice(HttpServletRequestrequest,
HttpServletResponseresponse)throwsServletException,IOException{
response.setContentType("text/html");
=newDefaultCategoryDataset();
//这是一组数据
dataTime.addValue(52,"0-6","2010-1-1");
dataTime.addValue(86,"6-12","2010-1-1");
dataTime.addValue(126,"12-18","2010-1-1");
dataTime.addValue(42,"18-24","2010-1-1");
//这是一组数据
dataTime.addValue(452,"0-6","2010-1-2");
dataTime.addValue(96,"6-12","2010-1-2");
dataTime.addValue(254,"12-18","2010-1-2");
dataTime.addValue(126,"18-24","2010-1-2");
//这是一组数据
dataTime.addValue(256,"0-6","2010-1-3");
dataTime.addValue(86,"6-12","2010-1-3");
dataTime.addValue(365,"12-18","2010-1-3");
dataTime.addValue(24,"18-24","2010-1-3");
try{
DefaultCategoryDatasetdata=dataTime;
//使用ChartFactory创建3D柱状图,不想使用3D,直接使用createBarChart
JFreeChartchart=ChartFactory.createBarChart3D(
"网站时间段访问量统计",
"时间",
"访问量",
data,
PlotOrientation.VERTICAL,
true,
false,
false
);
//设置整个图片的背景色
chart.setBackgroundPaint(Color.PINK);
//设置图片有边框
chart.setBorderVisible(true);
Fontkfont=newFont("宋体",Font.PLAIN,12);//底部
FonttitleFont=newFont("宋体",Font.BOLD,25);//图片标题
//图片标题
chart.setTitle(newTextTitle(chart.getTitle().getText(),titleFont));
//底部
chart.getLegend().setItemFont(kfont);
//得到坐标设置字体解决乱码
CategoryPlotcategoryplot=(CategoryPlot)chart.getPlot();
categoryplot.setDomainGridlinesVisible(true);
categoryplot.setRangeCrosshairVisible(true);
categoryplot.setRangeCrosshairPaint(Color.blue);
NumberAxisnumberaxis=(NumberAxis)categoryplot.getRangeAxis();
numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
BarRendererbarrenderer=(BarRenderer)categoryplot.getRenderer();
barrenderer.setBaseItemLabelFont(newFont("宋体",Font.PLAIN,12));
barrenderer.setSeriesItemLabelFont(1,newFont("宋体",Font.PLAIN,12));
CategoryAxisdomainAxis=categoryplot.getDomainAxis();
/*------设置X轴坐标上的文字-----------*/
domainAxis.setTickLabelFont(newFont("sans-serif",Font.PLAIN,11));
/*------设置X轴的标题文字------------*/
domainAxis.setLabelFont(newFont("宋体",Font.PLAIN,12));
/*------设置Y轴坐标上的文字-----------*/
numberaxis.setTickLabelFont(newFont("sans-serif",Font.PLAIN,12));
/*------设置Y轴的标题文字------------*/
numberaxis.setLabelFont(newFont("宋体",Font.PLAIN,12));
/*------这句代码解决了底部汉字乱码的问题-----------*/
chart.getLegend().setItemFont(newFont("宋体",Font.PLAIN,12));
ChartUtilities.writeChartAsJPEG(response.getOutputStream(),1.0f,
chart,500,300,null);
}catch(Exceptiones){
es.printStackTrace();
}
}
}
‘伍’ js 做3D的柱状图和饼状图的js库有哪些求大神们介绍。只限制js库,或者纯javascript。谢谢~~
当然是highchart 好用 !!!!
‘陆’ 如何使用html和js,css代码生成柱状图和饼状图
建议直接使用JSChart或HighChart、EChart、FusionCharts之类的工具,里面CSS\JS都是组装好的,只需要调整一些参数即可使用。
‘柒’ 如何做柱状图或饼状图
插入——对象——在“新建”选项卡里面
选择“Microsoft
Excel
图标”
‘捌’ 前端用echarts实现表格形柱形图的有哪些
ECharts,缩写来自Enterprise Charts,商业级数据图表,一个纯Javascript的图表库,可以流畅的运行在PC和移动设备上,兼容当前绝大部分浏览器(IE6/7/8/9 /10/11,chrome,firefox,Safari等),底层依赖轻量级的Canvas类库ZRender,提供直观,生动,可交互,可高度个性 化定制的数据可视化图表。创新的拖拽重计算、数据视图、值域漫游等特性大大增强了用户体验,赋予了用户对数据进行挖掘、整合的能力。支持折线图(区域图)、柱状图(条状图)、散点图(气泡图)、K线图、饼图(环形图)、雷达图(填充雷达图)、和弦图、力导向布局图、地图、仪表 盘、漏斗图、事件河流图等12类图表,同时提供标题,详情气泡、图例、值域、数据区域、时间轴、工具箱等7个可交互组件,支持多图表、组件的联动和混搭展 现。模块化单文件引入(推荐)1新建一个echarts.html文件,为ECharts准备一个具备大小(宽高)的Dom,2新建script标签引入模块化单文件echarts.js,3新建script标签中为模块加载器配置echarts和所需图表的路径(相对路径为从当前页面链接到echarts.js),4script标签内动态加载echarts和所需图表,回调函数中可以初始化图表并驱动图表的生成,5浏览器中打开ecarts.html,就可以看到以下效果,:END标签式单文件引入新建一个echarts.html文件,为ECharts准备一个具备大小(宽高)的Dom,新建script标签引入echart-all.js,新建script,使用全局变量echarts初始化图表并驱动图表的生成,浏览器中打开echarts.html,可以看到如下效果,
‘玖’ 柱状图与饼状图的区别
柱形图在比较相互之间的差距比较明显直观,饼状图是反应在同一范围内各自的占比时比较直观!
‘拾’ C#怎样实现报表的柱状图,饼状图,折线图
以下是实现报表的柱状图,饼状图,折线图的详细操作步骤:
第一步:在工程中添加ActiveReports区域报表
第二步:添加Chart控件至报表设计界面
第三步:设置报表属性
第四步:定制图表属性
具体的步骤实现,请参考下面的博客
http://blog.gcpowertools.com.cn/post/ActiveReports_Multi_Series_Chart.aspx