「javaweb折线」javaweb折线图

博主:adminadmin 2023-03-19 17:59:09 431

本篇文章给大家谈谈javaweb折线,以及javaweb折线图对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

java web生成折线图插件

这个简单,用ireport,可以下载5.0版本,超级简单,我现在就在用

Java-web 编写代码时 代码下面出现红色曲线,鼠标放在上面显示处理指令未关闭,该如何解决?

有时候myeclipse是这样的,只要确实写对了,运行没问题就行了。myeclipse只是做个错误检查,不影响编译

求javaweb的调用百度地图api的项目 能实现基本功能

html

head

!--引用百度地图--

script type="text/javascript" src=""

/script

title如何调用API/title

!-- 设计样式container容器:占50%大小--

style type="text/css"

#container{width:100%;height:100%;}

/style

/head

body style="margin-top:0; margin-left:0"

div id="container" style="margin-top:0; margin-left:0"/div

script type="text/javascript"

var map = new BMap.Map("container");//在container容器中创建一个地图,参数container为div的id属性;

map.addControl(new BMap.NavigationControl()); //初始化地图控件

map.addControl(new BMap.ScaleControl());

map.addControl(new BMap.OverviewMapControl());

var point = new BMap.Point(114.704605,38.282669);//定位,实际应用时,这个应该设置到参数中

map.centerAndZoom(point,20); //将point移到浏览器中心,并且地图大小调整为20街道级;

//其他坐标点

var points=new Array();

points.push(new BMap.Point(114.705027, 38.284326));//实际应用时,从数据库获取

points.push(new BMap.Point(114.701187, 38.284475));

points.push(new BMap.Point(114.700315, 38.285264));

points.push(new BMap.Point(114.706064, 38.284457));

points.push(new BMap.Point(114.706136, 38.284173));

var deps=["特种车辆","特种车辆","特种车辆","特种车辆","特种车辆","特种车辆"];

var personName=["王鹏","李大力","胡皓东","陈谦","大山","匿名用户"];

//alert(deps[0]+"/"+personName[0]);

for(var i=0;ipoints.length;i++){

addMarker(i);

/*marker = new BMap.Marker(points[i]);

map.addOverlay(marker);

marker.addEventListener("click",function(){

//创建信息窗口

var opts = {

width : 30, // 信息窗口宽度

height: 30, // 信息窗口高度

title : deps[i] // 信息窗口标题

}

var infoWindow = new BMap.InfoWindow(personName[i], opts); // 创建信息窗口对象

map.openInfoWindow(infoWindow, map.getCenter()); // 打开信息窗口

});*/

}

function addMarker(j){

marker = new BMap.Marker(points[j]); // 创建标注

map.addOverlay(marker);

var opts = {

width : 10, // 信息窗口宽度

height: 10, // 信息窗口高度

title : deps[j] // 信息窗口标题

}

var infoWindow = new BMap.InfoWindow(personName[j], opts); // 创建信息窗口对象

marker.addEventListener("click", function(){ this.openInfoWindow(infoWindow); });

//marker.setLabel(new BMap.Label("我是百度,呵呵",{offset:new BMap.Size(10,-40)}));

}

//标注

/*var marker = new BMap.Marker(point);

map.addOverlay(marker);

marker.addEventListener("click",function(){ //点击标注时出发事件

alert("您点击了标注");

});

marker.enableDragging(); //标注可拖拽

//创建信息窗口

var opts = {

width : 30, // 信息窗口宽度

height: 30, // 信息窗口高度

title : "Hello" // 信息窗口标题

}

var infoWindow = new BMap.InfoWindow("World", opts); // 创建信息窗口对象

map.openInfoWindow(infoWindow, map.getCenter()); // 打开信息窗口

//折线

var polyline = new BMap.Polyline([

new BMap.Point(114.705027, 38.284326),

new BMap.Point(114.701187, 38.284475),

new BMap.Point(114.700315, 38.285264)

],

{strokeColor:"blue", strokeWeight:6, strokeOpacity:0.5} //蓝色、宽度为6

);

map.addOverlay(polyline); */

/script

/body

/html

JAVAWEB项目怎么实现验证码

import java.awt.Color;

import java.awt.Font;

import java.awt.Graphics;

import java.awt.image.BufferedImage;

import java.io.IOException;

import java.io.OutputStream;

import java.util.Random;

import javax.imageio.ImageIO;

public class Code {

   

    // 图片的宽度。

    private int width = 160;

    // 图片的高度。

    private int height = 38;

    // 验证码字符个数

    private int codeCount = 4;

    // 验证码干扰线数

    private int lineCount = 20;

    // 验证码

    private String code = null;

    // 验证码图片Buffer

    private BufferedImage buffImg = null;

    Random random = new Random();

    

    private boolean type = false;

    public Code() {

       

    }

    public Code(int width, int height) {

        this.width = width;

        this.height = height;

    }

    public Code(int width, int height, int codeCount) {

        this.width = width;

        this.height = height;

        this.codeCount = codeCount;

    }

    public Code(int width, int height, int codeCount, int lineCount) {

        this.width = width;

        this.height = height;

        this.codeCount = codeCount;

        this.lineCount = lineCount;

    }

    

    public void init(boolean type){

       this.type = type;

    }

    // 生成图片

    private void creatImage(boolean type) {

        int fontWidth = width / codeCount;// 字体的宽度

        int fontHeight = height - 5;// 字体的高度

        int codeY = height - 8;

        // 图像buffer

        buffImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);

        Graphics g = buffImg.getGraphics();

        //Graphics2D g = buffImg.createGraphics();

        // 设置背景色

        g.setColor(getRandColor(200, 250));

        g.fillRect(0, 0, width, height);

        

        

        

        // 设置字体

        Font font = null;

        if(!type) font = new Font("Fixedsys", Font.BOLD, fontHeight);

        else font = getFont(fontHeight);

        g.setFont(font);

        // 设置干扰线

        for (int i = 0; i  lineCount/2; i++) {

            int xs = random.nextInt(width);

            int ys = random.nextInt(height);

            int xe = xs + random.nextInt(width);

            int ye = ys + random.nextInt(height);

            g.setColor(getRandColor(1, 255));

            if(!type) g.drawLine(xs, ys, xe, ye);

            else shear(g, width, height, getRandColor(1, 255)) ;

        }

        // 添加噪点

        float yawpRate = 0.01f;// 噪声率

        int area = (int) (yawpRate * width * height);

        for (int i = 0; i  area; i++) {

            int x = random.nextInt(width);

            int y = random.nextInt(height);

            buffImg.setRGB(x, y, random.nextInt(255));

        }

        String str1 = randomStr(codeCount);// 得到随机字符

        this.code = str1;

        for (int i = 0; i  codeCount; i++) {

            String strRand = str1.substring(i, i + 1);

            g.setColor(getRandColor(1, 255));

            // g.drawString(a,x,y);

            // a为要画出来的东西,x和y表示要画的东西最左侧字符的基线位于此图形上下文坐标系的 (x, y) 位置处

            

            g.drawString(strRand, i*fontWidth+3, codeY);

        }

        

    }

    // 得到随机字符

    private String randomStr(int n) {

        String str1 = "ABCDEFGHJKLMNOPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz1234567890";//I和l不要

        String str2 = "";

        int len = str1.length() - 1;

        double r;

        for (int i = 0; i  n; i++) {

            r = (Math.random()) * len;

            str2 = str2 + str1.charAt((int) r);

        }

        return str2;

    }

    // 得到随机颜色

    private Color getRandColor(int fc, int bc) {// 给定范围获得随机颜色

        if (fc  255)

            fc = 255;

        if (bc  255)

            bc = 255;

        int r = fc + random.nextInt(bc - fc);

        int g = fc + random.nextInt(bc - fc);

        int b = fc + random.nextInt(bc - fc);

        return new Color(r, g, b);

    }

    

    /**

     * 产生随机字体

     */

    private Font getFont(int size) {

        Random random = new Random();

        Font font[] = new Font[5];

        font[0] = new Font("Ravie", Font.PLAIN, size);

        font[1] = new Font("Antique Olive Compact", Font.PLAIN, size);

        font[2] = new Font("Fixedsys", Font.PLAIN, size);

        font[3] = new Font("Wide Latin", Font.PLAIN, size);

        font[4] = new Font("Gill Sans Ultra Bold", Font.PLAIN, size);

        return font[random.nextInt(5)];

    }

    

    // 扭曲方法

    private void shear(Graphics g, int w1, int h1, Color color) {

        shearX(g, w1, h1, color);

        shearY(g, w1, h1, color);

    }

    private void shearX(Graphics g, int w1, int h1, Color color) {

        int period = random.nextInt(2);

        boolean borderGap = true;

        int frames = 1;

        int phase = random.nextInt(2);

        for (int i = 0; i  h1; i++) {

            double d = (double) (period  1)

                    * Math.sin((double) i / (double) period

                            + (6.2831853071795862D * (double) phase)

                            / (double) frames);

            g.copyArea(0, i, w1, 1, (int) d, 0);

            if (borderGap) {

                g.setColor(color);

                g.drawLine((int) d, i, 0, i);

                g.drawLine((int) d + w1, i, w1, i);

            }

        }

    }

    private void shearY(Graphics g, int w1, int h1, Color color) {

        int period = random.nextInt(40) + 10; // 50;

        boolean borderGap = true;

        int frames = 20;

        int phase = 7;

        for (int i = 0; i  w1; i++) {

            double d = (double) (period  1)

                    * Math.sin((double) i / (double) period

                            + (6.2831853071795862D * (double) phase)

                            / (double) frames);

            g.copyArea(i, 0, 1, h1, 0, (int) d);

            if (borderGap) {

                g.setColor(color);

                g.drawLine(i, (int) d, i, 0);

                g.drawLine(i, (int) d + h1, i, h1);

            }

        }

    }

    

    public void write(OutputStream sos) throws IOException {

        if(buffImg == null) creatImage(type);

        ImageIO.write(buffImg, "png", sos);

//        JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(sos);

//        encoder.encode(buffImg);

        sos.close();

    }

    public BufferedImage getBuffImg() {

       if(buffImg == null) creatImage(type);

        return buffImg;

    }

    public String getCode() {

        return code.toLowerCase();

    }

    

    //使用方法

 /*public void getCode3(HttpServletRequest req, HttpServletResponse response,HttpSession session) throws IOException{

        // 设置响应的类型格式为图片格式

            response.setContentType("image/jpeg");

            //禁止图像缓存。

            response.setHeader("Pragma", "no-cache");

            response.setHeader("Cache-Control", "no-cache");

            response.setDateHeader("Expires", 0);

            

            

            CreateImageCode vCode = new CreateImageCode(100,30,5,10);

            session.setAttribute("code", vCode.getCode());

            vCode.write(response.getOutputStream());

            response.flushBuffer();

     }*/

}

java web动态图形报表工具推荐

FineReport就是纯java编写的报表工具,有丰富的图表功能,不仅提供了常见的图表类型。其中包括:条形图、柱状图、折线图、面积图、饼图、散点图、雷达图、仪表盘等,还支持多种类型的组合显示,并可以集成第三方图表。

javaweb折线的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于javaweb折线图、javaweb折线的信息别忘了在本站进行查找喔。