趋势图 (vue-trend-chart)

Simple trend charts for Vue.js.

Vue.js的简单趋势图。

View Demo 查看演示 View Github 查看Github

:cd:安装 (:cd: Installation)

npm i vue-trend-chart

:火箭:用法 (:rocket: Usage)

import Vue from "vue";
import TrendChart from "vue-trend-chart";Vue.use(TrendChart);

Example:

例:

<TrendChart:datasets="[{data: [10, 50, 20, 100, 40, 60, 80],smooth: true,fill: true}]":grid="{verticalLines: true,horizontalLines: true}":labels="{xLabels: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],yLabels: 5}":min="0">
</TrendChart>

:wrench:道具 (:wrench: Props)

datasets (datasets)

Required Type: Array

必填类型: 数组

Array of objects with properties for each dataset.

具有每个数据集属性的对象数组。

grid (grid)

Type: Object

类型: 对象

Grid properties

网格属性

labels (labels)

Type: Object

类型: 对象

Labels properties

标签属性

min (min)

Type: Number Default: min value from datasets

类型: 数字默认值:数据集中的最小值

max (max)

Type: Number Default: max value from datasets

类型: 数字默认值:数据集中的最大值

padding (padding)

Type: String Default: "5"

类型: 字符串默认值:“ 5”

If you set a large stroke-width on your lines, you may notice that it gets "cropped" towards the edges. It's similar to "padding" CSS property but without specifying units.

如果在行上设置较大的笔划宽度 ,则可能会注意到它朝着边缘“被裁剪”。 它类似于“ padding” CSS属性,但未指定单位。

Examples: "5" apply to all four sides "5 10" vertical | horizontal "5 15 10" top | horizontal | bottom "5 10 15 20" top | right | bottom | left

示例: "5"应用于所有四个侧面"5 10"垂直| 卧式"5 15 10"顶部| 卧式| 底部"5 10 15 20"顶部| 对| 底部| 剩下

interactive (interactive)

Type: Boolean Default: false

类型: 布尔值默认值: false

Allows to set onmousemove interaction. Set to true to enable.

允许设置onmousemove互动。 设置为true以启用。

:zap:活动 (:zap: Events)

mouse-move (mouse-move)

Callback function for onmouseover interaction.
Receives an object {index: Number, data: Array} parameter based on current active line.
This function has no effect if interactive isn't set to true.

用于onmouseover交互的回调函数。
根据当前活动行接收对象 {index: Number, data: Array}参数。
如果没有将interactive设置为true则此功能无效。

:chart_with_upwards_trend:数据集道具 (:chart_with_upwards_trend: Dataset Props)

Chart line (curve) properties

图表线(曲线)属性

data (data)

Type: Number|Object

类型: 数字|对象

Example: [70, 100, 400, 180, 100] or [{ value: 70 }, { value: 100 }, { value: 400 }, { value: 180 }, { value: 100 }]
For object type you can also add other properties to use them in interactive mode.

例如: [70, 100, 400, 180, 100][{ value: 70 }, { value: 100 }, { value: 400 }, { value: 180 }, { value: 100 }]
对于对象类型,您还可以添加其他属性以在interactive模式下使用它们。

className (className)

Type: String

类型: 字符串

Allows to append custom class to chart line for future styling.

允许将自定义类添加到图表线以用于将来的样式。

smooth (smooth)

Type: Boolean Default: false

类型: 布尔值默认值: false

Allows the peaks to be 'rounded' out.

允许峰被“四舍五入”。

stroke (stroke)

Type: Boolean Default: true

类型: 布尔值默认值: true

If false, the line is not drawn for this dataset.

如果为false ,则不会为此数据集绘制线。

fill (fill)

Type: Boolean Default: false

类型: 布尔值默认值: false

Allows to fill the area under the line. Set to true to enable.

允许填充线下的区域。 设置为true以启用。

showPoints (showPoints)

Type: Boolean Default: false

类型: 布尔值默认值: false

Allows to show points. Set to true to enable.

允许显示点。 设置为true以启用。

:hash:网格道具 (:hash: Grid Props)

verticalLines (verticalLines)

Type: Boolean Default: false

类型: 布尔值默认值:false

Allows to show vertical gridlines. Set to true to enable.

允许显示垂直网格线。 设置为true以启用。

verticalLinesNumber (verticalLinesNumber)

Type: Number Default: number of xLabels

类型: 数字默认值: xLabels数量

Allows to set custom number of vertical gridlines.
This prop has no effect if verticalLines isn't set to true.

允许设置垂直网格线的自定义数量。
如果verticalLines未设置为true则此道具无效。

horizontalLines (horizontalLines)

Type: Boolean Default: false

类型: 布尔值默认值:false

Allows to show horizontal gridlines. Set to true to enable.

允许显示水平网格线。 设置为true以启用。

horizontalLinesNumber (horizontalLinesNumber)

Type: Number Default: number of yLabels

类型: 数字默认值: yLabels数量

Allows to set custom number of horizontal gridlines.
This prop has no effect if horizontalLines isn't set to true.

允许设置水平网格线的自定义数量。
如果horizontalLines未设置为true则此道具无效。

:abc:标签道具 (:abc: Labels Props)

xLabels (xLabels)

Type: Array

类型: 数组

X axis labels.
Example: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]

X轴标签。
例如: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]

yLabels (yLabels)

Type: Number

类型: 数字

Number of Y axis labels. Labels text is based on data values.

Y轴标签数。 标签文本基于数据值。

yLabelsTextFormatter (yLabelsTextFormatter)

Type: Function

类型: 功能

Allows to format Y axis labels text.
Example: val => "$" + Math.round(val * 100) / 100.
This function has no effect if yLabels prop has no value.

允许格式化Y轴标签文本。
示例: val => "$" + Math.round(val * 100) / 100
如果yLabels没有值,则此功能无效。

:art:样式 (:art: Styling)

Just use CSS to style your charts.

只需使用CSS设置图表样式即可。

Here is an example of a tree structure with available class names:

这是具有可用类名的树结构的示例:

<svg class="vtc"><g class="grid"><g class="vertical"><line class="line"></line>...</g><g class="horizontal"><line class="line"></line>...</g></g><g class="labels"><g class="x-labels"><g class="label"><text></text></g>...</g><g class="y-labels"><g class="label"><text></text></g>...</g></g><g class="curve"><path class="fill"></path><path class="stroke"></path><g class="points"><circle class="point"></circle>...</g></g>...<line class="active-line"></line>
</svg>

:hammer:发展 (:hammer: Development)

npm install
npm run dev

翻译自: https://vuejsexamples.com/simple-trend-charts-for-vue-js/

Vue.js的简单趋势图相关推荐

  1. vue.js更改颜色_如何使用Vue.js实现简单的标题更改应用程序

    vue.js更改颜色 by Anoob Bava 通过Anoob Bava 如何使用Vue.js实现简单的标题更改应用程序 (How to implement a simple title chang ...

  2. 使用Vue.js的简单拾色器

    选色器 (vue-colorpicker) A Simple Color Picker With Vue.js 使用Vue.js的简单拾色器 View demo 查看演示 Download Sourc ...

  3. 仿vue.js实现简单模板引擎(2kB)

    仿vue.js实现简单模板引擎(2kB) 点击预览 index.html <!DOCTYPE html> <html lang="zh-CN"> <h ...

  4. 【JS】Vue.js实现简单的ToDoList(一)——前期准备

    一.前言 最近开始学习轻量级的mvvm框架Vue.js.就中文文档来说,算是很齐全了.之前本来在学习1.0版本,某日突然打开官网发现已更新为2.0.便把之后的都改为了2.0的语法.ps:如果恰好你是V ...

  5. vue实现搜索框搜索新增_基于Vue.js实现简单搜索框

    主要用到的知识很简单,简单的vuejs2.0的知识就够了.源码用了.vue构建和ES6,用了webpack打包等等.我资历还浅,先用一个简单的.js的写. 先看效果 这里有两个组件,一个组件是logo ...

  6. 利用Vue.js实现简单员工管理系统(增删查)的功能

    员工管理系统 注意!!此篇博客没有涉及后台数据库,所有数据自己设定,不经过数据库来增删改查!! 我们想要实现一个简单的员工管理系统案例需要以下几个步骤,我们一起来康康叭~~ 第一步:首先先实现基础的表 ...

  7. vue.js的简单自动求和计算

    一.导入vue.js 可以用cdn,也可以用内嵌去官网下载插件https://vuejs.org/js/vue.js. <script src="https://cdn.bootcss ...

  8. Vue.js实现简单的按钮点击改变css样式

    本人是前端的初学者,也在自学Vue.js,在自己编写系统的过程遇到的小问题,在这里分享给大家,若有什么不对的地方还请各位指正喔(づ ̄ 3 ̄)づ 一.效果 二.前端代码 这是静态页面代码部分(就两个简单 ...

  9. 使用Vue.js搭建简单的表格页面

    <!DOCTYPE html> <html><head><meta charset="utf-8" /><title>我 ...

  10. vue引入three.js3维地图_vue-chartjs使用 Chart.js 和 Vue.js 搭建简单和漂亮的图表

    简介 vue-chartjs 让你在 Vue 中能更好的使用 Chart.js . 非常适合想要尽快启动和运行简单图表的人.它抽象了一些简单的逻辑, 但是也暴露了 Chart.js 对象, 提供了极大 ...

最新文章

  1. QtCreator动态编译jsoncpp完美支持x86和arm平台
  2. .net 从txt中读取行数据_Python读取txt数据并绘图
  3. 知识图谱如何让智能金融“变魔术”
  4. linux下安装nagios
  5. matlab 数字识别_在MATLAB中利用神经网络进行分类
  6. JVM源码阅读-本地库加载流程和原理
  7. 页面加载完时再动态添加脚步
  8. outlook 附件保存位置-附件无法打开
  9. 【渝粤教育】电大中专工程图学基础作业 题库
  10. self-sizing cell的一个问题
  11. java线程的状态改变(练习)
  12. 祖传CMOS走出家门,佳能将在传感器供应圈中决战索尼
  13. MVPArms框架学习遇到的一个问题——普通Activity配合Fragment出现空指针
  14. AD15怎么导入图片做丝印 或者做 LOGO
  15. 人民币转换美金的c语言代码大全,人民币和美元大写格式在线工具,美元美金数字金额转换大写,外币大写金额...
  16. android 蓝牙耳机 找不到驱动程序,bluetooth外围设备找不到驱动程序怎么办
  17. Linux配置ip地址
  18. 浅析 Hadoop 中的数据倾斜
  19. 计算机领域SI单位,it领域什么是si
  20. 微信公众号现金红包红包 企业付款openid 获取

热门文章

  1. C语言-书籍资料汇总
  2. Web服务器之搭建python自带静态Web服务器
  3. 自学Python编程的第\七天----------来自苦逼的转行人
  4. 百度地图 实现 热力图
  5. 不做“OUTMAN”!笔记本热门词汇盘点
  6. 移动硬盘插入提示需要格式化RAW_分区变成RAW格式怎么办?手把手教你解决方法...
  7. Django发送电子邮件
  8. Android样式系列:自定义按钮样式
  9. 转发 微博 Qzone 微信 草根创业英雄时代落幕:贾跃亭戴威们一去不复返
  10. 【学习笔记】Baby Step Giant Step算法及其扩展