java代码运行图表,java运行流程图
Java怎么显示图表
java显示图表的话,都会使用一些框架或者其他人已经开发好的工具,比如echart等等,都是很好的图表绘制工具。
10年积累的成都网站建设、网站设计经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先制作网站后付款的网站建设流程,更有临沧免费网站建设让你可以放心的选择与我们合作。
eclipse中用JAVA代码怎么画柱形图表
用jfreechart
jfreechart绘制柱状图
import java.io.File;
import java.io.IOException;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;
/*
* 绘制柱状图
*你亮哥
* */
public class BarChart3DDemo
{
public static void main(String[] args)
{
try
{
//设置主题
ChartFactory.setChartTheme(Theme.getTheme());
//构造数据
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.addValue(100, "JAVA","1");
dataset.addValue(200, "js","1");
dataset.addValue(200, "C++", "2");
dataset.addValue(300, "C", "3");
dataset.addValue(400, "HTML", "4");
dataset.addValue(400, "CSS", "5");
/*
* public static JFreeChart createBarChart3D(
* java.lang.String title, 设置图表的标题
* java.lang.String categoryAxisLabel, 设置分类轴的标示
* java.lang.String valueAxisLabel, 设置值轴的标示
* CategoryDataset dataset, 设置数据
* PlotOrientation orientation, 设置图表的方向
* boolean legend, 设置是否显示图例
* boolean tooltips,设置是否生成热点工具
* boolean urls) 设置是否显示url
*/
JFreeChart chart = ChartFactory.createBarChart3D("编程语言统计", "语言",
"学习人数", dataset, PlotOrientation.VERTICAL, true, false,
false);
//保存图表
ChartUtilities.saveChartAsPNG(new File("E:/chart/BarChart3D.png"), chart, 800, 500);
System.out.println("绘图完成");
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
===================================================================================
//一条线 有点 有数
package Test;
import java.awt.Color;
import java.awt.Font;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartFrame;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.AxisSpace;
import org.jfree.chart.labels.ItemLabelAnchor;
import org.jfree.chart.labels.ItemLabelPosition;
import org.jfree.chart.labels.StandardXYItemLabelGenerator;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.renderer.xy.XYItemRenderer;
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
import org.jfree.chart.title.TextTitle;
import org.jfree.data.time.Month;
import org.jfree.data.time.TimeSeries;
import org.jfree.data.time.TimeSeriesCollection;
import org.jfree.ui.RectangleInsets;
import org.jfree.ui.TextAnchor;
public class try123 {
public static void main(String[] args){
//首先构造数据
TimeSeries timeSeries = new TimeSeries("BMI", Month.class);
// 时间曲线数据集合
TimeSeriesCollection lineDataset = new TimeSeriesCollection();
// 构造数据集合
timeSeries.add(new Month(1, 2009), 45);
timeSeries.add(new Month(2, 2009), 46);
timeSeries.add(new Month(3, 2009), 1);
timeSeries.add(new Month(4, 2009), 500);
timeSeries.add(new Month(5, 2009), 43);
timeSeries.add(new Month(6, 2009), 324);
timeSeries.add(new Month(7, 2009), 632);
timeSeries.add(new Month(8, 2009), 34);
timeSeries.add(new Month(9, 2009), 12);
timeSeries.add(new Month(10, 2009), 543);
timeSeries.add(new Month(11, 2009), 32);
timeSeries.add(new Month(12, 2009), 225);
lineDataset.addSeries(timeSeries);
JFreeChart chart = ChartFactory.createTimeSeriesChart("", "date", "bmi", lineDataset, true, true, true);
//增加标题
chart.setTitle(new TextTitle("XXXBMI指数", new Font("隶书", Font.ITALIC, 15)));
chart.setAntiAlias(true);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setAxisOffset(new RectangleInsets(10,10,10,10));//图片区与坐标轴的距离
plot.setOutlinePaint(Color.PINK);
plot.setInsets(new RectangleInsets(15,15,15,15));//坐标轴与最外延的距离
// plot.setOrientation(PlotOrientation.HORIZONTAL);//图形的方向,包括坐标轴。
AxisSpace as = new AxisSpace();
as.setLeft(25);
as.setRight(25);
plot.setFixedRangeAxisSpace(as);
chart.setPadding(new RectangleInsets(5,5,5,5));
chart.setNotify(true);
// 设置曲线是否显示数据点
XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer)plot.getRenderer();
xylineandshaperenderer.setBaseShapesVisible(true);
// 设置曲线显示各数据点的值
XYItemRenderer xyitem = plot.getRenderer();
xyitem.setBaseItemLabelsVisible(true);
xyitem.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE10, TextAnchor.BASELINE_LEFT));
xyitem.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
xyitem.setBaseItemLabelFont(new Font("Dialog", 1, 14));
plot.setRenderer(xyitem);
//显示
ChartFrame frame = new ChartFrame("try1", chart);
frame.pack();
frame.setVisible(true);
}
}
java操作word中的excel(对应的是图表,如柱状图)
我.net中也遇到了相同的问题:你可以先看一下下面代码,应该大部分你能用到,只是chart属性可能有点问题,之前尝试成功过,但是由于我不小心删除了一些系统文件里的内容,就有些运行不起来了
我是先循环的word中的shape
foreach (Microsoft.Office.Interop.Word.Shape shape in docFile.Shapes)
{
if(shape.Name=="Chart_图表")
{
shape.Chart.ChartData.Activate();
Microsoft.Office.Interop.Excel.Workbook wb = (Microsoft.Office.Interop.Excel.Workbook)shape.Chart.ChartData.Workbook;
Microsoft.Office.Interop.Excel.Worksheet wSh = (Microsoft.Office.Interop.Excel.Worksheet)wb.Worksheets[1];
//然后添加新数据
for (int r = 0; r tempdt.Rows.Count; r++)
{
for (int k = 0; k tempdt.Columns.Count; k++)
{
Microsoft.Office.Interop.Excel.Range Rng1 = wSh.Cells[r + 2, k + 1] as Microsoft.Office.Interop.Excel.Range;
Rng1.Value = tempdt.Rows[r][k];
}
}
wb.Application.ScreenUpdating = true;
wb.Close(Type.Missing, Type.Missing, Type.Missing);
chart.Refresh();
shape.Chart.Refresh();
}
}
如何使用java做统计图表
//参考地址去网站下js控件,下面是饼图的代码,下图是我的代码效果
function query1(housetype,redStatisticsList,text0,cashingSum,tranferSum){
!--红包发放数据--
var myrodiusred = echarts.init(document.getElementById('mainrodius'));//ID
var redHousehold = housetype;
var redMoney = redStatisticsList;
var allMoney = 0;//总金额
$.each(redStatisticsList,function(index,item){
allMoney =allMoney+ Number(item.value);
})
optionTwo = {
title : {
text: text0,
subtext: "总金额:"+allMoney+"\n\n提现总额:"+cashingSum+"\n\n到账总额:"+tranferSum,
x:'center'
},
tooltip : {
trigger: 'item',
formatter: "{a} br/{b} ({d}%)"
},
legend: {
orient: 'vertical',
left: 'left',
data: housetype
},
series : [
{
type: 'pie',
radius : '55%',
center: ['50%', '60%'],
data:redMoney,
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
}
}
]
};
myrodiusred.setOption(optionTwo);
}
分享名称:java代码运行图表,java运行流程图
标题URL:http://azwzsj.com/article/dsedcci.html