首先我们的工具绝对顶尖,绝对绚丽。如果有需要代码,可以加我微信索取。18500591275

前几天有个客户找到我,问我这个能不能做,我看自己也干了10年前端了,实在做不了,后来人家说给你10000你能做吗?我说能考虑,什么时候我也为金钱所动了。

媳妇是药学博士,绝对的学霸,回去给我媳妇一看,说能做,我写算法,你写程序不就完事了吗?好吧,一万块钱到手

2、我们一步一步剖析绘制的过程。

首先我们初始化canves对象。

 c = document.getElementById("canvas_circle");
ctx = c.getContext("2d");

设定局部的变量

 radius = c.height / 2 - 60; //半径
ox = radius + 450, oy = radius + 70; //圆心
width = 30, height = 10; //图例宽和高
posX = ox * 2 + 20, posY = 30; //
textX = posX + width + 5, textY = posY + 10; img = $("#logo_name").get(0);
ctx.drawImage(img, 30, 30, 100, 800); img = $("#tuli").get(0);
ctx.drawImage(img, 1250, 100, 220, 300);

然后进行下面的一系列的操作。

//绘制外侧的饼图
DrawPie(ox, oy, radius); var innerWhiteR = radius - 100
//绘制白色圆环
drawCircular(ox, oy, innerWhiteR, "#fff") //绘制黄色圆环
var innerYellowR = radius - 130;
drawCircular(ox, oy, innerYellowR, "#fff34f") //绘制蓝色圆环
drawCircular(ox, oy, radius - 135, "#0445e1") //再次绘制蓝色圆环
drawCircular(ox, oy, radius - 140, "#3370ff")
//绘制内侧的饼图
var innerRPi = radius - 195;
DrawPie(ox, oy, innerRPi, true); var radius1 = radius + 40;
var outerSpaceR1 = radius + 20;
var outerSpaceR2 = radius + 40; var xixian = 3;
var cuxian = 15; //绘制双线
drawLine(ox, oy, 0, innerRPi, cuxian, "#fff", 7.5);
drawLine(ox, oy, 0, innerRPi, xixian, "#000", 7.5);
drawLine(ox, oy, innerYellowR, outerSpaceR2, cuxian, "#fff", 7.5);
drawLine(ox, oy, innerYellowR, outerSpaceR2, xixian, "#000", 7.5,"xiaolan","07:30 日盘开始起动系统",1); drawLine(ox, oy, 0, innerRPi, cuxian, "#fff", 8 + (45/60));
drawLine(ox, oy, 0, innerRPi, xixian, "#000", 8 + (45 / 60));
drawLine(ox, oy, innerYellowR, outerSpaceR2, cuxian, "#fff", 8 + (45 / 60));
drawLine(ox, oy, innerYellowR, outerSpaceR2, xixian, "#000", 8 + (45 / 60), "xiaohong","08:55日盘集合竞价",2); drawLine(ox, oy, 0, innerRPi, cuxian, "#fff", 15);
drawLine(ox, oy, 0, innerRPi, xixian, "#000", 15);
drawLine(ox, oy, innerYellowR, outerSpaceR2, cuxian, "#fff", 15);
drawLine(ox, oy, innerYellowR, outerSpaceR2, xixian, "#000", 15, "xiaoing",'15:00日盘毕盘开始结算',7); drawLine(ox, oy, 0, innerRPi, cuxian, "#fff", 19.5);
drawLine(ox, oy, 0, innerRPi, 2, "#000", 19.5);
drawLine(ox, oy, innerYellowR, outerSpaceR2, cuxian, "#fff", 19.5);
drawLine(ox, oy, innerYellowR, outerSpaceR2, xixian, "#000", 19.5, "xiaoing", '19:30夜盘开始起动系统',12); drawLine(ox, oy, 0, innerRPi, cuxian, "#fff", 20+(55/60));
drawLine(ox, oy, 0, innerRPi, 2, "#000", 20 + (55 / 60));
drawLine(ox, oy, innerYellowR, outerSpaceR2, cuxian, "#fff", 20 + (45 / 60));
drawLine(ox, oy, innerYellowR, outerSpaceR2, xixian, "#000", 20 + (45 / 60), "xiaoqiu", '20:55夜盘集合竞价',13); drawLine(ox, oy, 0, innerRPi, cuxian, "#fff", 23.5);
drawLine(ox, oy, 0, innerRPi, xixian, "#000", 23.5);
drawLine(ox, oy, innerYellowR, outerSpaceR2, cuxian, "#fff", 23.5);
drawLine(ox, oy, innerYellowR, outerSpaceR2, xixian, "#000", 23.5, "xiaoing","23:30 开始关闭系统",15);
//绘制双线 //绘制单线
drawLine(ox, oy, innerYellowR, innerWhiteR, xixian, "#000",9);
drawLine(ox, oy, innerWhiteR, radius, xixian, "#eee", 9);
drawLine(ox, oy, radius, outerSpaceR1, xixian, "#000", 9, "xiaoing",'9:00日盘连续交易开始',3); drawLine(ox, oy, innerYellowR, innerWhiteR, xixian, "#000", 10.25);
drawLine(ox, oy, innerWhiteR, radius, xixian, "#eee", 10.25);
drawLine(ox, oy, radius, outerSpaceR1, xixian, "#000", 10.25, "xiaoqiu","10:15日盘休市至10:30",4); drawLine(ox, oy, innerYellowR, innerWhiteR, xixian, "#000", 11.5);
drawLine(ox, oy, innerWhiteR, radius, xixian, "#eee", 11.5);
drawLine(ox, oy, radius, outerSpaceR1, xixian, "#000", 11.5, "xiaoqiu",'11:30 日盘休市至13:30',5); drawLine(ox, oy, innerYellowR, innerWhiteR, xixian, "#000", 13.5);
drawLine(ox, oy, innerWhiteR, radius, xixian, "#eee", 13.5);
drawLine(ox, oy, radius, outerSpaceR1, xixian, "#000", 13.5, "xiaoqiu", '13:30 日盘持续交易',6); drawLine(ox, oy, innerYellowR, innerWhiteR, xixian, "#000", 15.5);
drawLine(ox, oy, innerWhiteR, radius, xixian, "#eee", 15.5);
drawLine(ox, oy, radius, outerSpaceR1, xixian, "#000", 15.5, "xiaoqiu","15:30 结算完成",8); drawLine(ox, oy, innerYellowR, innerWhiteR, xixian, "#000", 16.67);
drawLine(ox, oy, innerWhiteR, radius, xixian, "#eee", 16.67);
drawLine(ox, oy, radius, outerSpaceR1, xixian, "#000", 16.67, "xiaoqiu",'16:40 日盘开始关闭系统',9); drawLine(ox, oy, innerYellowR, innerWhiteR, xixian, "#000", 17);
drawLine(ox, oy, innerWhiteR, radius, xixian, "#eee", 17);
drawLine(ox, oy, radius, outerSpaceR1, xixian, "#000", 17, "xiaoqiu","日盘两地三中心数据备份",10); drawLine(ox, oy, innerYellowR, innerWhiteR, xixian, "#000", 18);
drawLine(ox, oy, innerWhiteR, radius, xixian, "#eee", 18);
drawLine(ox, oy, radius, outerSpaceR1, xixian, "#000", 18, "xiaoqiu",'17:00至19:00系统维护',11); drawLine(ox, oy, innerYellowR, innerWhiteR, xixian, "#000", 21);
drawLine(ox, oy, innerWhiteR, radius, xixian, "#eee", 21);
drawLine(ox, oy, radius, outerSpaceR1, xixian, "#000", 21, "xiaoqiu",'21:00夜盘连续交易开始',14); drawLine(ox, oy, innerYellowR, innerWhiteR, xixian, "#000", 23.75);
drawLine(ox, oy, innerWhiteR, radius, xixian, "#eee", 23.75);
drawLine(ox, oy, radius, outerSpaceR1, xixian, "#000", 23.75,"xiaoqiu",'23:35夜盘数据备份',16); //绘制图片
drawPic();
暂无分类();

共有函数的写法

function DrawPie(oxInput, oyInput, radiusInput, drawText) {
///////////////// 绘制扇面
//第一个点   
var begAngle = 0 - (Math.PI / 12) * 6.5;
var endAngle = 0 + (Math.PI / 12) * 1.5;
ctx.fillStyle = '#8e97e4';
ctx.beginPath();
ctx.moveTo(oxInput, oyInput);
ctx.arc(oxInput, oyInput, radiusInput, begAngle, endAngle);
ctx.closePath();
ctx.fill();
if (drawText) {
ctx.save();

ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.font = 'bold 11pt Arial'
ctx.fillStyle = '#000';
ctx.translate(oxInput, oyInput);
ctx.fillText("夜盘数据备份", Math.sin(Math.PI * 2 / 24 * 3) * radiusInput*.7+10, Math.cos(Math.PI * 2 / 24 * 3) * radiusInput * (-1)*.7);
ctx.fillText("夜盘闭市", Math.sin(Math.PI * 2 / 24 * 3) * radiusInput * .7 + 10, Math.cos(Math.PI * 2 / 24 * 3) * radiusInput * (-1) * .7+20);
ctx.fillText("系统关闭状态", Math.sin(Math.PI * 2 / 24 * 3) * radiusInput * .7 + 10, Math.cos(Math.PI * 2 / 24 * 3) * radiusInput * (-1) * .7+40);

ctx.restore();
}

//第二个点
begAngle = endAngle
endAngle += (Math.PI / 720) * 85;
ctx.fillStyle = '#8de3e4';
ctx.beginPath();
ctx.moveTo(oxInput, oyInput);
ctx.arc(oxInput, oyInput, radiusInput, begAngle, endAngle);
ctx.closePath();
ctx.fill();

if (drawText) {
ctx.save();
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.font = 'bold 11pt Arial'
ctx.fillStyle = '#000';

ctx.translate(Math.sin(Math.PI * 2 / 24 * 8.25) * (radiusInput*0.76) + oxInput,
oyInput - Math.cos(Math.PI * 2 / 24 * 8.25) * (radiusInput * 0.76));
ctx.rotate(Math.PI * 2 / 24 * 2.2);
ctx.fillText("日盘系统起动", 0, 0);
ctx.restore();
}

//第三个点
begAngle = endAngle
endAngle += (Math.PI / 720) * 365;

ctx.fillStyle = '#8de398';
ctx.beginPath();
ctx.moveTo(oxInput, oyInput);
ctx.arc(oxInput, oy, radiusInput, begAngle, endAngle);
ctx.closePath();
ctx.fill();

if (drawText) {
ctx.save();

ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.font = 'bold 11pt Arial'
ctx.fillStyle = '#000';
ctx.translate(oxInput, oyInput);
ctx.fillText("日盘连续交易", Math.sin(Math.PI * 2 / 24 * 12) * radiusInput * .7 , Math.cos(Math.PI * 2 / 24 * 12) * radiusInput * (-1) * .7);

ctx.restore();
}

//第四个点
begAngle = endAngle
endAngle += (Math.PI / 720) * 270;

ctx.fillStyle = '#e3e38d';
ctx.beginPath();
ctx.moveTo(oxInput, oyInput);
ctx.arc(oxInput, oyInput, radiusInput, begAngle, endAngle);
ctx.closePath();
ctx.fill();
if (drawText) {
ctx.save();

ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.font = 'bold 11pt Arial'
ctx.fillStyle = '#000';
ctx.translate(oxInput, oyInput);
ctx.fillText("每日结算", Math.sin(Math.PI * 2 / 24 * 17) * radiusInput * .7 + 10, Math.cos(Math.PI * 2 / 24 * 17) * radiusInput * (-1) * .7-40);
ctx.fillText("数据备份", Math.sin(Math.PI * 2 / 24 * 17) * radiusInput * .7 + 10, Math.cos(Math.PI * 2 / 24 * 17) * radiusInput * (-1) * .7-20 );
ctx.fillText("日盘闭市", Math.sin(Math.PI * 2 / 24 * 17) * radiusInput * .7 + 10, Math.cos(Math.PI * 2 / 24 * 17) * radiusInput * (-1) * .7 );
ctx.fillText("系统维护", Math.sin(Math.PI * 2 / 24 * 17) * radiusInput * .7 + 10, Math.cos(Math.PI * 2 / 24 * 17) * radiusInput * (-1) * .7 + 20);

ctx.restore();
}

//第五个点

begAngle = endAngle
endAngle += (Math.PI / 720) * 85;

ctx.fillStyle = '#e2b58c';
ctx.beginPath();
ctx.moveTo(oxInput, oyInput);
ctx.arc(oxInput, oyInput, radiusInput, begAngle, endAngle);
ctx.closePath();
ctx.fill();
if (drawText) {

ctx.save();
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.font = 'bold 11pt Arial'
ctx.fillStyle = '#000';

ctx.translate(Math.sin(Math.PI * 2 / 24 * 20.25) * (radiusInput * 0.76) + oxInput,
oyInput - Math.cos(Math.PI * 2 / 24 * 20.25) * (radiusInput * 0.76));
ctx.rotate(Math.PI * 2 / 24 * 2.2);
ctx.fillText("夜盘系统起动", 0, 0);
ctx.restore();

}

//第6个点
begAngle = endAngle
endAngle += (Math.PI / 720) * 155;

ctx.fillStyle = '#e38d8e';
ctx.beginPath();
ctx.moveTo(oxInput, oyInput);
ctx.arc(oxInput, oyInput, radiusInput, begAngle, endAngle);
ctx.closePath();
ctx.fill();
if (drawText) {
ctx.save();
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.font = 'bold 11pt Arial'
ctx.fillStyle = '#000';

ctx.translate(Math.sin(Math.PI * 2 / 24 * 22) * (radiusInput * 0.7) + oxInput,
oyInput - Math.cos(Math.PI * 2 / 24 * 22) * (radiusInput * 0.7));
ctx.rotate(Math.PI * 2 / 24 *4);
ctx.fillText("夜盘连续交易", 0, 0);
ctx.restore();
}
////////////////////////
}

 function drawCircular(oxInput, oyInput, radiusInput, fillStyle) {
ctx.beginPath();
ctx.arc(oxInput, oyInput, radiusInput, 0, Math.PI * 2, false);
ctx.fillStyle = fillStyle;
ctx.fill();
}

基于canvas自动化运维工具的更多相关文章

  1. Ansible自动化运维工具-上

    [Ansible特点] 1)Ansible与saltstack均是基于Python语言开发的 2)安装使用简单,基于不同插件和模块实现各种软件,平台,版本的管理以及支持虚拟容器多层级的部署 3)不需要 ...

  2. 自动化运维工具Ansible详细部署 (转载)

    自动化运维工具Ansible详细部署 标签:ansible 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://sofar.blog. ...

  3. 自动化运维工具之 Ansible 介绍及安装使用

    一.初识Ansible 介绍: Absible 使用 模块(Modules)来定义配置任务.模块可以用标准脚本语言(Python,Bash,Ruby,等等)编写,这是一个很好的做法,使每个模块幂等.A ...

  4. 自动化运维工具之ansible

    自动化运维工具之ansible   一,ansible简介 ansible是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet.cfengine.chef.func.fab ...

  5. Linux实战教学笔记25:自动化运维工具之ansible (一)

    第二十五节 ansible之文件的批量分发 标签(空格分隔): Linux实战教学笔记-陈思齐 ---本教学笔记是本人学习和工作生涯中的摘记整理而成,此为初稿(尚有诸多不完善之处),为原创作品,允许转 ...

  6. 自动化运维工具——ansible详解(一)

    ansible 简介 ansible 是什么? ansible是新出现的自动化运维工具,基于Python开发,集合了众多运维工具(puppet.chef.func.fabric)的优点,实现了批量系统 ...

  7. 企业级自动化运维工具应用实战-ansible

    背景 公司计划在年底做一次大型市场促销活动,全面冲刺下交易额,为明年的上市做准备.公司要求各业务组对年底大促做准备,运维部要求所有业务容量进行三倍的扩容,并搭建出多套环境可以共开发和测试人员做测试,运 ...

  8. 项目实战10.1—企业级自动化运维工具应用实战-ansible

    实战环境: 公司计划在年底做一次大型市场促销活动,全面冲刺下交易额,为明年的上市做准备.公司要求各业务组对年底大促做准备,运维部要求所有业务容量进行三倍的扩容,并搭建出多套环境可以共开发和测试人员做测 ...

  9. 【实战小项目】python开发自动化运维工具--批量操作主机

    有很多开源自动化运维工具都很好用如ansible/salt stack等,完全不用重复造轮子.只不过,很多运维同学学习Python之后,苦于没小项目训练.本篇就演示用Python写一个批量操作主机的工 ...

随机推荐

  1. .NET Core工作流引擎(RoadFlow)多语言版发布

    经过两个月的辛苦努力.NET Core工作流引擎(RoadFlow)多语言版发布了,在原来只有一种简体中文语言的基础上增加了繁体中文和英文两种语言,还可以通过扩展增加任意语言包.至此RoadFlow工 ...

  2. 【Python】itertools之product函数

    [转载]源博客 product 用于求多个可迭代对象的笛卡尔积(Cartesian Product),它跟嵌套的 for 循环等价.即: product(A, B) 和 ((x,y) for x in ...

  3. 2019 梆梆安全java面试笔试题 (含面试题解析)

      本人5年开发经验.18年年底开始跑路找工作,在互联网寒冬下成功拿到阿里巴巴.今日头条.梆梆安全等公司offer,岗位是Java后端开发,因为发展原因最终选择去了梆梆安全,入职一年时间了,也成为了面 ...

  4. 8个有意思的JavaScript面试题

    摘要: 神奇的JS系列. 作者:前端小智 原文:8个问题看你是否真的懂 JS Fundebug经授权转载,版权归原作者所有. JavaScript 是一种有趣的语言,我们都喜欢它,因为它的性质.浏览器 ...

  5. Windows 2003 IIS6.0下配置ASP+MySQL+PHP+ISAPI_Rewrite+Zend+Xcache

    windows 2003,自己买吧... 安装IIS6.0:安装系统后在"控制面板"->"添加或删除程序"->"添加/删除Windows组 ...

  6. Linux下对input设备调用ioctl时指定EVIOCGBIT选项时的缓冲区该多大【转】

    转自:https://blog.csdn.net/imred/article/details/82669990 版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出 ...

  7. AWS之EC2实例搭建LAMP服务器

    在 Amazon Linux 2 上安装 LAMP Web 服务器 创建EC2实例,在安全组添加HTTP(80)规则 步骤 1:准备 LAMP 服务器 1.使用putty连接到你的EC2实例上(AMI ...

  8. luoguP4393Sequence

    https://www.luogu.org/problem/P4393 题意 给你n个点的一个数列,每次可以合并两个相邻的数为他们的最大值,且代价为这两个数的最大值,求将整个序列合并为1个数的最小代价 ...

  9. 201871010112-梁丽珍《面向对象程序设计(java)》第八周学习总结

    项目 内容 这个作业属于哪个课程 https://www.cnblogs.com/nwnu-daizh/ 这个作业的要求在哪里 https://www.cnblogs.com/nwnu-daizh/p ...

  10. 201871010106-丁宣元 《面向对象程序设计(java)》第十三周学习总结

    201871010106-丁宣元 <面向对象程序设计(java)>第十三周学习总结 正文开头: 项目 内容 这个作业属于哪个课程 https://home.cnblogs.com/u/nw ...