anychart说明文档

   今天学习anychart,在慧都控件网上看有关文档,模仿试着做了个demo,发现慧都空间网的“Flash图表AnyChart应用教程六:创建圆形仪表”里的指针“<pointer type="bar" value="35" color="Gray" />”有误,应该为:type="needle"。还是看英文原文可靠啊!附英文文档网址:http://www.anychart.com/products/anychart/docs/users-guide/index.html?gauges.html

Your first circular gauge

  • Overview
  • Step 1. Basic Gauge - Creating Circular Gauge
  • Step 2. Scale Settings and Title
  • Step 3. Labels and Tickmarks
  • Step 4. Color Ranges
  • Step 5. Adding Markers
  • Step 6. Pointer
  • Step 7. Tuning frame and Margins
  • Final. Monthly Sales Gauge is Ready

Overview

In this tutorial we will go through the creation of the basic circular gauge step by step, trying to cover all major elements and pointing to the articles for the further tuning a gauge.

So, a Circular Gauge is as minimum a radial scale that sweeps any angle from 0 to 360 degrees and a pointer, Needle or Knob that indicates values on that scale. Gauge scale is usually colored for easy value quality distinction.

We will start from the scratch adding or configuring gauge elements on the each step, as a result we will create a typical speedometer gauge.

Note: in this sample AnyChart.swf is used, but you can optimize the page with selected chart type if you use custom type dependent swf. These swfs are described in SWFs Guide.

Gauge Sample:

  • Launch the sample
  • Download the sample

to top

Step 1. Basic Gauge - Creating Circular Gauge

First of all we need to choose a gauge type, in this sample it should be circular gauge, so we put the following XML settings:

XML Syntax
  • XML Code
Plain code
01<?xml version="1.0" encoding="UTF-8"?>
02 <anychart>
03   <gauges>
04     <gauge>
05       <circular />
06     </gauge>
07   </gauges>
08 </anychart>
<?xml version="1.0" encoding="UTF-8"?> <anychart> <gauges> <gauge> <circular /> </gauge> </gauges> </anychart>

As you can clearly see from this XML Snippet we tell AnyChart just to create one circular gauge, as a result we get the following output:

Live Sample:  Sample Circular Gauge Step 1
anychart说明文档

As you can see, by default gauge has no pointers and some default 360 degrees scale with labels and tickmarks, when trying to recreate this sample please note that you should set appropriate size for AnyChart object in you page (height="300" width="300" in our sample). AnyChart Gauges can be resized, but if you want to create the chart with a single circular gauge on it - it is recommended to start with width that is equal to the height.

to top

Step 2. Scale Settings and Title

Now we will define the scale of the gauge, let's say that our speedometer shows value from 0 to 120 miles per hour.

Let's put this into XML:

XML Syntax
  • XML Code
Plain code
01<?xml version="1.0" encoding="UTF-8"?>
02 <anychart>
03   <gauges>
04     <gauge>
05       <chart_settings>
06         <title>
07           <text><![CDATA[MPH Speedometer]]></text>
08         </title>
09       </chart_settings>
10       <circular>
11         <axis radius="50" start_angle="90" sweep_angle="180">
12           <scale minimum="0" maximum="120" major_interval="20" minor_interval="5" />
13         </axis>
14       </circular>
15     </gauge>
16   </gauges>
17 </anychart>
<?xml version="1.0" encoding="UTF-8"?> <anychart> <gauges> <gauge> <chart_settings> <title> <text>MPH Speedometer</text> </title> </chart_settings> <circular> <axis radius="50" start_angle="90" sweep_angle="180"> <scale minimum="0" maximum="120" major_interval="20" minor_interval="5" /> </axis> </circular> </gauge> </gauges> </anychart>

Note: <axis radius="50"> means that we want gauge axis to cover 50% percents of a gauge size - to understand this better you need to study Positioning, Resizing and Axis Overview Tutorials. start_angle sets the angle from which your scale should be drawn. The point from which the calculation starts is in the lowest points of your circular gauge and the direction is CW. sweep_angle is an actual angle of your circular gauge. In our example we will create a so-called "semi-radial" 180 degrees speedometer.

Now we will see the following result:

Live Sample:  Sample Circular Gauge Step 2
anychart说明文档

We have created a semi-radial speedometer. However if you want your speedometer to remain circular you should set type attribute of frame node to "circular". By default it is set to "Auto" and crops unused space.

to top

Step 3. Labels and Tickmarks

When the scale is ready we can set how labels and tickmarks, we will remove decimal digits from labels and minor tickmarks. We also add a "mph" suffix to our labels. Only axis node is shown for better comprehension:

XML Syntax
  • XML Code
Plain code
01<axis radius="50" start_angle="90" sweep_angle="180">
02   <scale minimum="0" maximum="120" major_interval="20" minor_interval="5" />
03   <labels enabled="true">
04     <font bold="true" />
05     <format><![CDATA[{%Value}{numDecimals:0} mph]]></format>
06   </labels>
07   <minor_tickmark enabled="false" />
08 </axis>
<axis radius="50" start_angle="90" sweep_angle="180"> <scale minimum="0" maximum="120" major_interval="20" minor_interval="5" /> <labels enabled="true"> <font bold="true" /> <format>{%Value}{numDecimals:0} mph</format> </labels> <minor_tickmark enabled="false" /> </axis>

Now the scale looks this way:

Live Sample:  Sample Circular Gauge Step 3
anychart说明文档

to top

Step 4. Color Ranges

An essential part of linear gauges are color ranges that are used to distinct the quality of value shown, in our example we will create three color ranges "Slow", "Average" and "Fast" speed levels. The syntax should be as follows:

XML Syntax
  • XML Code
Plain code
01<axis radius="50" start_angle="90" sweep_angle="180">
02   <scale minimum="0" maximum="120" major_interval="20" minor_interval="5" />
03   <scale_bar enabled="false" />
04   <labels enabled="true">
05     <font bold="true" />
06     <format><![CDATA[{%Value}{numDecimals:0} mph]]></format>
07   </labels>
08   <minor_tickmark enabled="false" />
09   <color_ranges>
10     <color_range start="0" end="40" color="Green" />
11     <color_range start="40" end="80" color="Yellow" />
12     <color_range start="80" end="120" color="Red" />
13   </color_ranges>
14 </axis>
<axis radius="50" start_angle="90" sweep_angle="180"> <scale minimum="0" maximum="120" major_interval="20" minor_interval="5" /> <scale_bar enabled="false" /> <labels enabled="true"> <font bold="true" /> <format>{%Value}{numDecimals:0} mph</format> </labels> <minor_tickmark enabled="false" /> <color_ranges> <color_range start="0" end="40" color="Green" /> <color_range start="40" end="80" color="Yellow" /> <color_range start="80" end="120" color="Red" /> </color_ranges> </axis>

Here we are - our gauge is colored:

Live Sample:  Sample Circular Gauge Step 4
anychart说明文档

Note that as we have added color ranges we no longer need scale_bar. So we have disabled it.

to top

Step 5. Adding Markers

Also, it may be useful to point our some special point, for example, the optimal speed, we can so that with the custom axis labels, that can have a custom tickmark.

XML Syntax
  • XML Code
Plain code
01 <axis>
02   <scale minimum="0" maximum="100" major_interval="10" minor_interval="2" />
03   <labels enabled="true">
04     <font bold="true" />
05     <format><![CDATA[{%Value}{numDecimals:0}]]></format>
06   </labels>
07   <minor_tickmark enabled="false" />
08   <custom_labels>
09     <custom_label value="65" enabled="true">
10       <label enabled="true" align="Outside" padding="20">
11         <format><![CDATA[Optimal]]></format>
12       </label>
13       <tickmark enabled="true" shape="Star5" auto_rotate="false" width="10" length="10" align="Inside" padding="-12">
14         <fill color="Blue" />
15         <border color="DarkColor(Yellow)" />
16       </tickmark>
17     </custom_label>
18   </custom_labels>
19 </axis>
<axis> <scale minimum="0" maximum="100" major_interval="10" minor_interval="2" /> <labels enabled="true"> <font bold="true" /> <format>{%Value}{numDecimals:0}</format> </labels> <minor_tickmark enabled="false" /> <custom_labels> <custom_label value="65" enabled="true"> <label enabled="true" align="Outside" padding="20"> <format>Optimal</format> </label> <tickmark enabled="true" shape="Star5" width="10" length="10" align="Inside" padding="-12"> <fill color="Blue" /> <border color="DarkColor(Yellow)" /> </tickmark> </custom_label> </custom_labels> </axis>

Now we can clearly see optimal speed on the gauge.

Live Sample:  Sample Circular Gauge Step 5
anychart说明文档

to top

Step 6. Pointer

One of the last, but one of the main parts of a gauge is a pointer - there are several ways to display it, but we will choose the most typical for this type of the gauges (all previously set nodes are left apart in the snippet):

XML Syntax
  • XML Code
Plain code
01<?xml version="1.0" encoding="UTF-8"?>
02 <anychart>
03   <gauges>
04     <gauge>
05       <circular>
06         <pointers>
07           <pointer type="bar" value="35" color="Gray" />
08         </pointers>
09       </circular>
10     </gauge>
11   </gauges>
12 </anychart>
<?xml version="1.0" encoding="UTF-8"?> <anychart> <gauges> <gauge> <circular> <pointers> <pointer type="bar" value="35" color="Gray" /> </pointers> </circular> </gauge> </gauges> </anychart>

Now the current sales level is shown, as you can see from the syntax you can place several pointers on one gauge, they can be of a different shape and placed differently (this fact, by the way, allows to create the Bullet Graphs with AnyChart easily):

Live Sample:  Sample Circular Gauge Step 6
anychart说明文档

Note that the view of our needle pointer is far from the ideal. We have simply changed its color without thoroughly examining its numerous attributes. For further information refer to Pointers Tutorial.

to top

Step 7. Tuning frame and Margins

The final step in gauge creation is the definition of a frame and setting up margins. Frame is a complex graphical element that allows to display really nice-looking gauge. We will remove a general chart background and border, remove margins. The frame by default is enabled and has inner_stroke and outer_stroke. If you want you can disable your frame by setting "False" value to enabled attribute.

XML Syntax
  • XML Code
Plain code
01<?xml version="1.0" encoding="UTF-8"?>
02 <anychart>
03   <margin all="5" />
04   <gauges>
05     <gauge>
06       <chart_settings>
07         <title>
08           <text><![CDATA[MPH Speedometer]]></text>
09         </title>
10         <chart_background enabled="false">
11           <border enabled="false" />
12         </chart_background>
13       </chart_settings>
14     </gauge>
15   </gauges>
16 </anychart>
<?xml version="1.0" encoding="UTF-8"?> <anychart> <margin all="5" /> <gauges> <gauge> <chart_settings> <title> <text>MPH Speedometer</text> </title> <chart_background enabled="false"> <border enabled="false" /> </chart_background> </chart_settings> </gauge> </gauges> </anychart>

And here is an output we get:

Live Sample:  Sample Circular Gauge Step 7
anychart说明文档

to top

Final Mph Speedometer Gauge is Ready

Now you know almost all basic settings and configurations of the circular gauge, you can go on studying a lot of other parameters that can be changed to create a gauge that will display the data of your choice in a right way.

If you haven't studied any other articles in documentation yet we recommend you to start with the following:

  • Architecture
  • Positioning
  • Resizing
  • Visual Appearance
  • Axis

to top

Current Page Online URL: Your first circular gauge

转载于:https://www.cnblogs.com/cookie3ms/p/4199788.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/360351.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

h5 神策埋点_咕咚技术总监唐平麟:神策使我们的数据平台成本降低约 75%,迭代效率提升 2~3 倍...

在这个数据爆炸的时代&#xff0c;数据成为各行各业出奇制胜的法宝&#xff0c;运动行业也不例外&#xff0c;那么大数据对运动业有什么价值呢&#xff1f;咕咚作为智能运动的倡导者和先行者&#xff0c;致力于成为全球领先的运动大数据和服务平台&#xff0c;现已为超过 1.5 亿…

JavaFX,Jigsaw项目和JEP 253

因此&#xff0c; Java 9可能会破坏您的代码 …… 如果您的项目使用JavaFX&#xff0c;则这尤其可能&#xff0c;因为许多自定义项和自制控件都需要使用内部API。 借助Project Jigsaw&#xff0c;这些内容将无法在Java 9中访问。幸运的是&#xff0c; Oracle在几天前宣布了 JE…

ios 获取是否静音模式_果粉感动:部分iOS“新功能”早已被安卓玩坏

一年一度的WWDC大会如期举行&#xff0c;今年不仅展示了全新的iOS、iPadOS以及macOS。当然&#xff0c;具体更新了什么相信早已经被各大媒体报道出来&#xff0c;本文并不是重复报道&#xff0c;相反的&#xff0c;iOS经过了13代的发展&#xff0c;有开创性的动作&#xff0c;也…

怎么把桌面计算机隐藏文件,怎么隐藏桌面文件夹名称?隐藏桌面图标下的文字的详细教程...

怎么隐藏桌面文件夹名称&#xff1f;桌面图标一多就会显得很凌乱&#xff0c;特别有的软件名称很长&#xff0c;那么有没有什么方法可以让桌面看起来很清爽呢&#xff1f;当然是有&#xff0c;去掉桌面应用的名称不就简洁清爽了&#xff1f;下面就教大家不利用第三方软件的情况…

window xp系统安装php环境_Windows Server 2003及XP系统如何安装SQL Server 2000数据库?

年头年初节假日就是小编的梗&#xff0c;忙得不可开交&#xff0c;这不越冷越刮风昨天服务器又崩了&#xff0c;折腾了一天安装好Windows Server 2003和IIS(这系统是有点老了&#xff0c;主要是单位机子和各系统也有点年头了&#xff0c;没办法)&#xff0c;做好各项配置后总算…

rnn神经网络 层次_精讲深度学习RNN三大核心点,三分钟掌握循环神经网络

每天给小编五分钟&#xff0c;小编用自己的代码&#xff0c;让你轻松学习人工智能。本文将剖析循环神经网络(RNN)的工作原理&#xff0c;精讲循环神经网络的特点和实现方式。野蛮智能&#xff0c;小白也能看懂的人工智能。循环神经网络从何而来&#xff1f;我在我的这篇文章介绍…

摆脱匿名类

我真的很喜欢编写和阅读lambda表达式-它们简洁&#xff0c;富于表现力和时尚&#xff08;来吧&#xff0c;这样就没关系了&#xff01;&#xff09;。 将此与匿名类进行比较。 这就是为什么我喜欢摆脱它们&#xff01; 在过去的几个月中&#xff0c;这种认识慢慢地实现了&…

ARM学习(24)Can的高阶认识和错误处理

笔者来聊一下CAN协议帧的认识和错误处理。 1、CAN协议帧认识 CAN 差分信号&#xff0c;是经过CAN收发器转成差分信号的&#xff0c;CAN RX和TX是逻辑电平。CAN的基础知识&#xff0c;可参考笔者这边文章&#xff1a;ARM学习&#xff08;21&#xff09;STM32 外设Can的认识与驱…

云桌面 瘦终端_小米盒子连接Citrix云桌面

先前看到很多公司使用Wyse、Hp等瘦终端设备登陆Citrix云桌面&#xff0c;便想购得一台瘦终端设备&#xff0c;想来只是为了测试&#xff0c;况且瘦终端价格不低&#xff0c;便一直未买。后使用自己的平板连接Citrix XenDesktop创建的Win7桌面&#xff0c;感觉效果很好&#xff…

Apache Mesos + Marathon和Java EE

Apache Mesos是一个开放源代码群集管理器&#xff0c;可在分布式应用程序或框架之间提供有效的资源隔离和共享。 Apache Mesos从计算机&#xff08;物理或虚拟&#xff09;上提取CPU&#xff0c;内存&#xff0c;存储和其他计算资源&#xff0c;从而使容错和弹性的分布式系统易…

计算机指令中数据寻址的方式,1.变址寻址需要在指令中提供一个寄存器编号和一个数值。 2.计算机的指令越多,功能越强越好。 3.程序计数...

满意答案happysk72推荐于 2017.12.16采纳率&#xff1a;57% 等级&#xff1a;12已帮助&#xff1a;21199人1.对变址寻址就是将寄存器(该寄存器一般称作基址寄存器)的内容与指令中给出的地址偏移量相加&#xff0c;从而得到一个操作数的有效地址。变址寻址方式常用于访问某基…

babel原理_带你了解 snowpack 原理,你还学得动么(下)

作者&#xff1a;AlienZHOU转发链接&#xff1a;https://zhuanlan.zhihu.com/p/149351900目录带你了解 snowpack 原理&#xff0c;你还学得动么(上)带你了解 snowpack 原理&#xff0c;你还学得动么(下)本篇小编建议小伙们从第一篇开始&#xff0c;按照顺序来看&#xff0c;更清…

测试社交软件有哪些,性格测试:测你适合哪个社交平台

你喜欢通过什么方式和人交流&#xff1f;随着网络世界越来越发达&#xff0c;人们越来越倾向于使用社交工具来维系与家人、朋友、同事之间的关系。不但在现实生活中不好直接表达出来的话通过网上交流的方式可以顺畅地表达出来&#xff0c;而且也节约了时间上的成本&#xff0c;…

VS2012无法安装cocos2d-x-2.1.4 解决方法及VS2012新建coco2d-x项目(一)

转自&#xff1a;http://www.cnblogs.com/wangpei/admin/EditPosts.aspx?opt1 &#xff08;注&#xff1a;此方法是可行&#xff0c;仅供参考&#xff0c;建议大家直接看我的 一见命令解决vs安装并创建cocos2d-x&#xff0c;如果你习惯了和以前一样在vs点击创建就用这个方法&a…

excelexportentity中设置null不显示的方法_一般人不知道的线程间数据交换Exchanger

线程间的数据共享除了定义一个共享数据然后各个线程去访问这种方式外&#xff0c;还可以使用Exchanger交换数据。简单案例首先看看Exchanger的运用&#xff0c;Exchanger最简单的测试代码&#xff0c;如下图&#xff1a;对应打印的结果如下&#xff1a;线程2创建对象java.lang.…

布尔表达式的语法及语义分析程序_XSS语义分析的阶段性总结(一)

作者&#xff1a;Kale 合天智汇前言由于X3Scan的研发已经有些进展了&#xff0c;所以对这一阶段的工作做一下总结&#xff01;对于X3Scan的定位&#xff0c;我更加倾向于主动被动的结合。主动的方面主要体现在可以主动抓取页面链接并发起请求&#xff0c;并且后期可能参考XSStr…

【黑金原创教程】【TimeQuest】【第二章】TimeQuest模型角色,网表概念,时序报告...

声明&#xff1a;本文为黑金动力社区&#xff08;http://www.heijin.org&#xff09;原创教程&#xff0c;如需转载请注明出处&#xff0c;谢谢&#xff01; 黑金动力社区2013年原创教程连载计划&#xff1a; http://www.cnblogs.com/alinx/p/3362790.html 《FPGA那些事儿--Tim…

设置springboot日志级别_Spring Boot 日志框架实践

概述Java应用中&#xff0c;日志一般分为以下5个级别&#xff1a;ERROR 错误信息WARN 警告信息INFO 一般信息DEBUG 调试信息TRACE 跟踪信息Spring Boot使用Apache的Commons Logging作为内部的日志框架&#xff0c;其仅仅是一个日志接口&#xff0c;在实际应用中需要为该接口来指…

计算机加分乘法套用,8+8+8+8+8写成乘法算式要怎样写?小学数学为何这么死板?...

88888写成乘法算式只能写8x5不能写5x8吗&#xff1f;小学数学为何这么死板&#xff1f;这个题目来自于某小学的期考试卷&#xff0c;是个填空题&#xff0c;88888写成乘法算式时给了两个空( )和( )&#xff0c;就有人提出来只能写8x5不能写5x8&#xff0c;所以应该只给一个空。…

投影元素直接隔离_摸着夜色上露台开投影,是巴塞罗那设计师的浪漫

总有人说&#xff0c;世界为你关上一扇门&#xff0c;定会为你留有一扇窗。在家闷上个把月&#xff0c;窗户直接担起了连接人们与外界的通道。既然观众出不了门&#xff0c;那不如让加油打气的海报们&#xff0c;自己爬上墙好了——人们打开窗子就能撞上。平面设计师Ral Goi一直…