AnyGantt创建基本的Venn Diagram(维恩图)教程

Stella981
• 阅读 661

AnyGantt是基于JavaScript的高级解决方案,用于构建复杂且信息丰富的甘特图。它完全跨浏览器和跨平台,可用于ASP.NET、ASP、PHP、JSP、ColdFusion、Ruby on Rails或简单的HTML页面。

点击下载AnyGantt正式版

套装

Venn图的外观设置可以配置为三种状态:正常,悬停和选择。使用normal(),hovered()和selected()方法。

将它们与以下方法结合:

  • fill()设置填充
  • hatchFill()设置填充图案
  • stroke()设置笔划

另外,您可以使用anychart.core.StateSettings中的其他方法。

请注意,这些设置仅影响圈子。要了解如何调整相交区域,请参阅下一节。

在下面的示例中,有一个配置了外观设置的维恩图:

// configure the visual settings of the chart chart.normal().fill("#00cc99", 0.3); chart.hovered().fill("#00cc99", 0.1); chart.selected().fill("#00cc99", 0.5); chart.normal().hatchFill("percent50", "#004d39"); chart.hovered().hatchFill("percent50", "#004d39"); chart.selected().hatchFill("percent50", "#004d39"); chart.normal().stroke("#004d39"); chart.hovered().stroke("#004d39", 2); chart.selected().stroke("#004d39", 4);

AnyGantt创建基本的Venn Diagram(维恩图)教程

交叉口

交叉口区域可以配置为三种状态。将crosslines()方法与normal(),hovered()和selected()方法一起使用。

结合使用以下方法:

  • fill()设置填充
  • hatchFill()设置填充图案
  • stroke()设置笔划

此示例显示了配置了相交外观的维恩图:

// configure the visual settings of intersections var intersections = chart.intersections();
intersections.normal().fill("green", 0.3); intersections.hovered().fill("green", 0.1); intersections.selected().fill("green", 0.5); intersections.normal().hatchFill("percent50", "white"); intersections.hovered().hatchFill("percent50", "white"); intersections.selected().hatchFill("percent50", "white"); intersections.normal().stroke("white"); intersections.hovered().stroke("white", 2); intersections.selected().stroke("white", 4);

AnyGantt创建基本的Venn Diagram(维恩图)教程

个人积分

您可以通过向数据中添加特殊字段来更改单个点(集合和相交点)的外观:

//create data var data = [ {x: "A", value: 100, normal: {fill: "#455a64 0.5"}, hovered: {fill: "#455a64 0.5"}, selected: {fill: "#455a64 0.5"} }, {x: "B", value: 100, normal: {fill: "#00bfa5 0.5"}, hovered: {fill: "#00bfa5 0.5"}, selected: {fill: "#00bfa5 0.5"} }, {x: "C", value: 200, normal: {fill: "#1976d2 0.5"}, hovered: {fill: "#1976d2 0.5"}, selected: {fill: "#1976d2 0.5"} }, {x: ["A", "B"], value: 10}, {x: ["B", "C"], value: 10, normal: {stroke: "2 white"}, hovered: {stroke: "2 white"}, selected: {stroke: "4 white"} } ];

// create a chart and set the data chart = anychart.venn(data);

AnyGantt创建基本的Venn Diagram(维恩图)教程

标签和工具提示

标签是可以放置在任何图表上任何位置的文本或图像元素(您可以在整个系列或单个点上启用它们)。对于文本标签,可以使用字体设置和文本格式器。

甲工具提示是文本时的曲线图上的点悬停在显示框。有许多可视设置和其他设置:例如,您可以使用字体设置和文本格式化程序来编辑文本,更改背景样式,调整工具提示的位置等等。

代币

创建维恩图时,可以为圆和相交设置标签和工具提示。

要更改标签的文本,请将labels()和format()方法与标记结合使用,并配置工具提示,请对tooltip()和format()方法进行相同的操作。

使用交集()方法设置交集的标签和工具提示。

以下是适用于维恩图的标记:

  • {%x}
  • {%value}
  • {%name}

此外,您始终可以向数据添加自定义字段,并使用与之对应的自定义标记。

此示例显示了如何使用令牌:

//create data var data = [ { x: "A", name: "Set A", custom_field: "info 1", value: 100 }, { x: "B", name: "Set A", custom_field: "info 2", value: 100 }, { x: ["A", "B"], name: "Set A + Set B", value: 25 } ];

// create a chart and set the data chart = anychart.venn(data);

// configure labels of circles chart.labels().format("{%name}\n\n{%custom_field}\n{%value}");

// configure labels of intersections chart.intersections().labels().format("{%name}\n\n{%value}");

// configure tooltips of circles chart.tooltip().format( "Set Info: {%custom_field}\nCardinality: {%value}" );

// configure tooltips of intersections chart.intersections().tooltip().format( "Intersection Info: {%custom_field}\nCardinality: {%value}" );

AnyGantt创建基本的Venn Diagram(维恩图)教程

格式化功能

要配置标签和工具提示,可以使用格式化功能和以下字段:

  • x
  • value
  • name

您还可以将自定义字段添加到数据中,并使用getData()方法对其进行引用。

在以下示例中,格式化功能用于仅在三个或更多圆的交点上显示标签,并在工具提示中显示交点数和自定义数据字段:

//create data var data = [ {x: "A", value: 100}, {x: "B", value: 100}, {x: "C", value: 100}, {x: ["A", "B"], value: 20, custom_field: "info 1"}, {x: ["A", "C"], value: 20, custom_field: "info 2"}, {x: ["B", "C"], value: 20, custom_field: "info 3"}, {x: ["A", "B", "C"], value: 20, "custom_field": "info 4"} ];

// create a chart and set the data chart = anychart.venn(data);

// configure labels of intersections chart.intersections().labels().format(function() { if (this.x.length > 2) return this.x; });

// configure tooltips of intersections chart.intersections().tooltip().format(function() { return "Value: " + this.value + "\n(" + this.x.length + " sets intersecting)\n\n" + this.getData("custom_field"); });

AnyGantt创建基本的Venn Diagram(维恩图)教程

本教程未完待续,感兴趣的朋友可以下载AnyGantt试用版免费体验哦~更多产品信息请咨询【在线客服】>>>

APS是慧都科技15年行业经验以及技术沉淀之作,通过连接企业接单、采购、制造、仓储物流等整个供应链流程,帮助提升企业生产效率。

点赞
收藏
评论区
推荐文章
blmius blmius
2年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
Stella981 Stella981
2年前
Opencv中Mat矩阵相乘——点乘、dot、mul运算详解
Opencv中Mat矩阵相乘——点乘、dot、mul运算详解2016年09月02日00:00:36 \牧野(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fme.csdn.net%2Fdcrmg) 阅读数:59593
Stella981 Stella981
2年前
Jenkins+Ansible+Gitlab自动化部署三剑客
JenkinsAnsibleGitlab自动化部署三剑客小中大showerlee2016031113:00Ansible(https://www.oschina.net/action/GoToLink?urlhttp%3A%2F%2Fwww.
Wesley13 Wesley13
2年前
P2P技术揭秘.P2P网络技术原理与典型系统开发
Modular.Java(2009.06)\.Craig.Walls.文字版.pdf:http://www.t00y.com/file/59501950(https://www.oschina.net/action/GoToLink?urlhttp%3A%2F%2Fwww.t00y.com%2Ffile%2F59501950)\More.E
Stella981 Stella981
2年前
Golang注册Eureka的工具包goeureka发布
1.简介提供Go微服务客户端注册到Eureka中心。点击:github地址(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fgithub.com%2FSimonWang00%2Fgoeureka),欢迎各位多多star!(已通过测试验证,用于正式生产部署)2.原理
Wesley13 Wesley13
2年前
1. 容器化部署一套云服务 第一讲 Jenkins(Docker + Jenkins + Yii2 + 云服务器))
容器化部署一套云服务系列1\.容器化部署一套云服务之Jenkins(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fwww.cnblogs.com%2Fjackson0714%2Fp%2Fdeploy1.html)一、购买服务器服务器!caeef00
Stella981 Stella981
2年前
Git提交本地以及远程仓库
项目方法Gc75n047Fm3109gDDPJ2006.07.14101007MpkyG专访抖音绽放公会「分享」运营经验(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fhzcya.com%2Fdywh%2F320.html)00azE2
Easter79 Easter79
2年前
The Complete Guide To Rooting Any Android Phone
PhoneWhitsonGordon(https://www.oschina.net/action/GoToLink?urlhttp%3A%2F%2Fwww.lifehacker.com.au%2Fauthor%2Fwhitsongordon%2F)7April,20118:00AMShare(https://ww
Stella981 Stella981
2年前
Essential Studio for UWP发布2017 v2,新增甘特图控件
EssentialStudioforUWP(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fwww.evget.com%2Fproduct%2F3894)是包含有35组件的综合套包,包括最快的图表和网格组件。所有组件根据当前被呈现的设备系列自适应渲染。EssentialStu
Stella981 Stella981
2年前
Google地球出现“无法连接到登录服务器(错误代码:c00a0194)”解决方法
Google地球出现“无法连接到登录服务器(错误代码:c00a0194)”解决方法参考文章:(1)Google地球出现“无法连接到登录服务器(错误代码:c00a0194)”解决方法(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fwww.codeprj.com%2Fblo