1 Star 0 Fork 0

eric.fang / coordinate-draw-line

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

CoordinateDrawLine

一个基于 vue3 开发的轻量、高效的坐标绘制线条工具

在线演示和使用手册(DEMO)

GIT地址

https://gitee.com/ericfang/coordinate-draw-line

安装

使用以下命令安装 coordinate-draw-line

npm install coordinate-draw-line
# 或
yarn add coordinate-draw-line

导入组件

全局导入

main.js 中全局引入 coordinate-draw-line

import {createApp} from "vue";
import App from "./App.vue";
// v3-drag-zoom 组件
import CoordinateDrawLine from "coordinate-draw-line";

createApp(App).use(CoordinateDrawLine).mount("#app");

按需导入

在需要的组件中导入 coordinate-draw-line


<script setup lang="ts">
  import {CoordinateDrawLine} from "coordinate-draw-line";

</script>

<template>
  <div class="" style="width: 800px;height: 480px;">
    <coordinate-draw-line
        :x-end="200"
        :y-end="100"
    ></coordinate-draw-line>
  </div>
</template>

API参数

CoordinateDrawLine

Props

参数名 类型 默认值 是否必须 说明
xStart number 0 坐标系左下角x起始大小
yStart number 0 坐标系左下角y起始大小
xEnd number 必填 坐标系右上角x结束大小
yEnd number 必填 坐标系右上角y结束大小
xAxisSplit int 10 X轴分割线的数量
yAxisSplit int 10 Y轴分割线的数量
splitStyle LineStyle {lineWidth:1,strokeStyle:'#aaa'} 分割线样式
axisStyle LineStyle {lineWidth:1,strokeStyle:'#000'} 轴线样式
lineStyle LineStyle {lineWidth:1,strokeStyle:'#000'} 默认线条样式
lineHoverStyle LineStyle {lineWidth:2,strokeStyle:'#000'} 默认鼠标悬浮在线条上样式
pointStyle PointStyle {lineWidth:1,radius:3} 默认点样式
pointHoverStyle PointStyle {lineWidth:2,radius:5} 默认鼠标悬浮在点上样式
textStyle TextStyle {fillStyle:'#000',font:'12px Arial'} 刻度文本样式
textDistance number 5 文本与轴线的距离
padding number 20 坐标系与容器之间的距离

Event

事件 参数 说明
changing (point:Point null, lines: Line[]) => void
changed (point:Point null, lines: Line[]) => void

Exposed

方法 参数 说明
addLine (line:Line)=>void 添加线条
removeLine (line:line)=>void 移除线条
clearLines ()=>void 清除所有线条
draw () => void 强制绘制一次canvas

Point

属性 类型 说明
x number x坐标
y number y坐标
line Line 所属线条
style PointStyle 样式
hoverStyle PointStyle 鼠标悬浮样式

PointStyle

属性 类型 说明
radius number 半径
fillStyle string 填充色
strokeStyle string 边框色
lineWidth number 边框宽度

Line

属性 类型 说明
start Point 起点
end Point 终点
style LineStyle 样式
hoverStyle LineStyle 鼠标悬浮样式
points Point[] 点列表
xDull DullType 单调性
yDull DullType 单调性
fixed number 保留小数位数
mergeDistance number 点合并距离(小于0将不会合并)

LineStyle

属性 类型 说明
strokeStyle string 线条颜色
lineWidth number 线条宽度

DullType

说明
increase 单调上升
decrease 单调下降
undefined 无约束

Text

属性 类型 说明
text string 文本内容
point Point 所在位置
align "left" | "center" | "right" 对齐方式
style TextStyle 文本样式

TextStyle

属性 类型 说明
font string 字体(12 Arial)
fillStyle string 填充颜色(#000)
MIT License Copyright (c) 2023 eric.fang Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

一个基于 `vue3` 开发的轻量、高效的坐标绘制线条工具 展开 收起
TypeScript 等 4 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/ericfang/coordinate-draw-line.git
git@gitee.com:ericfang/coordinate-draw-line.git
ericfang
coordinate-draw-line
coordinate-draw-line
master

搜索帮助