Skip to content

Commit 18bbe5a

Browse files
committed
docs: v8.2.0 docs.
1 parent 5a9ee3f commit 18bbe5a

File tree

7 files changed

+107
-19
lines changed

7 files changed

+107
-19
lines changed

docs/en/changelog.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
# Change Log
2+
## 8.2.0
3+
`2022-01-10`
4+
+ 🆕 Add instance methods `createHtml` and `removeHtml`.
5+
+ 🆕 Instance methods `subscribeAction` and `unsubscribeAction` add type `tooltip`.
6+
+ 🆕 Technical indicator template add attribute `shortName`.
7+
+ 🆕 Technical indicator template attribute `plot.color` supports `line`.
8+
+ 🆕 Technical indicator template attribute `styles` supports `margin`.
9+
+ 💄 Optimize mobile scroll event response.
10+
211
## 8.1.1
312
`2021-12-19`
413
+ 🐞 Fix the problem that the style technicalIndicator.tooltip.defaultValue does not take effect.

docs/en/instance-api.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,10 @@ chart.overrideTechnicalIndicator({
147147
shouldOhlc: true,
148148
shouldFormatBigNimber: false,
149149
styles: {
150+
margin: {
151+
top: 0.2,
152+
bottom: 0.1
153+
},
150154
bar: {
151155
upColor:'#26A69A',
152156
downColor:'#EF5350',
@@ -383,6 +387,36 @@ Remove tags, you can remove them in batches, just pass in the array in batches,
383387
- `tagId` Unique identification of the tag
384388

385389

390+
### removeTag(paneId, tagId)
391+
To remove tags, you can remove them in batches. You can pass in an array in batches. If the default is used, all of them will be removed.
392+
- `paneId` pane id, default removes all
393+
- `tagId` The unique identifier of the tag, by default removes all tags on the pane
394+
395+
396+
### createHtml(html, paneId)
397+
Create an html element that returns an id.
398+
- `html` element `{ id, position, content, style }`
399+
- `id` id
400+
- `position` position, type is `yAxis` and `content`, default is `content`
401+
- `style` html element container style, inline css style
402+
- `content` content, which can be a dom element or a string composed of dom elements
403+
- `paneId` window id, default is 'candle_pane'
404+
Example:
405+
```javascript
406+
chart.createHtml({
407+
id: 'html_1',
408+
position: 'content',
409+
style: { zIndex: 12 },
410+
content: '<div>8888888</div>'
411+
}, 'candle_pane')
412+
```
413+
414+
### removeHtml(paneId, htmlId)
415+
Remove an html element.
416+
- `paneId` pane id, by default delete all
417+
- `htmlId` element id, which can be a single id or an array of ids. By default, all items on the corresponding pane are deleted.
418+
419+
386420
### scrollByDistance(distance, animationDuration)
387421
Roll a certain distance.
388422
-`distance` distance
@@ -432,13 +466,13 @@ chart.setPaneOptions({
432466

433467
### subscribeAction(type, callback)
434468
Subscribe to chart actions.
435-
- `type` The type is 'zoom', 'scroll', 'crosshair' and 'pane_drag'
469+
- `type` The type is 'zoom', 'scroll', 'crosshair', 'tooltip' and 'pane_drag'
436470
- `callback` is a callback method
437471

438472

439473
### unsubscribeAction(type, callback)
440474
Unsubscribe from chart actions.
441-
- `type` type is 'zoom', 'scroll', 'crosshair' and 'pane_drag'
475+
- `type` type is 'zoom', 'scroll', 'crosshair', 'tooltip' and 'pane_drag'
442476
- `callback` callback method when subscribing
443477

444478

docs/en/technical-indicator.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ To complete a technical indicator template, you only need to generate a technica
2424
// The name of the technical indicator, a necessary field, is the only identifier of the technical indicator
2525
name:'xxx',
2626

27+
// For tooltip display
28+
shortName: 'xxx',
29+
2730
// Technical indicator calculation method, necessary fields
2831
// This field is a callback method, the callback parameters are the source data and calculated parameters of the current chart, and an array needs to be returned
2932
// kLineDataList chart raw data
@@ -90,19 +93,19 @@ To complete a technical indicator template, you only need to generate a technica
9093
```javascript
9194
{
9295
// Required fields, determine the return value of the method calcTechnicalIndicator
93-
key:'',
94-
// Can be defaulted, mainly for prompt
95-
title:'',
96-
// Default, drawing type, currently supports'line','circle' and'bar'
97-
type:'',
98-
// Basic comparison data, default
96+
key: '',
97+
// By default, mainly for prompt
98+
title: '',
99+
// By default, drawing type, currently supports'line','circle' and'bar'
100+
type: '',
101+
// By default, basic comparison data
99102
// If set, when the graph is bar, it will be drawn above and below this value, such as: the macd value of the MACD indicator
100103
baseValue: null,
101-
// It can be defaulted. It is a callback method. The color can be set according to the callback parameters. It will only take effect when the type is'circle' and'bar'
102-
// Return a string of color values
104+
// By default
105+
// Can be value or method, if it is a method, it needs to return a string of color values
103106
color: (data, options) => {},
104-
// It can be defaulted, it is a callback method, you can set whether it is hollow according to the callback parameters, and it will take effect only when the type is'circle' and'bar'
105-
// return a boolean value
107+
// By default, it only takes effect when type is 'circle' and 'bar'
108+
// Can be a fixed boolean value or a method, if it is a method, it needs to return a boolean value
106109
isStroke: (data, options) => {}
107110
}
108111
```

docs/zh-CN/changelog.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
# 更新日志
2+
## 8.2.0
3+
`2022-01-10`
4+
+ 🆕 新增实例方法 `createHtml``removeHtml`
5+
+ 🆕 实例方法 `subscribeAction``unsubscribeAction`新增类型`tooltip`
6+
+ 🆕 技术指标模板新增属性`shortName`
7+
+ 🆕 技术指标模板属性`plot.color`支持`line`
8+
+ 🆕 技术指标模板属性`styles`支持`margin`
9+
+ 💄 优化移动端滚动事件响应。
10+
211
## 8.1.1
312
`2021-12-19`
413
+ 🐞 修改样式technicalIndicator.tooltip.defaultValue不生效问题。

docs/zh-CN/instance-api.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ chart.overrideTechnicalIndicator({
148148
shouldOhlc: true,
149149
shouldFormatBigNumber: false,
150150
styles: {
151+
margin: {
152+
top: 0.2,
153+
bottom: 0.1
154+
},
151155
bar: {
152156
upColor: '#26A69A',
153157
downColor: '#EF5350',
@@ -383,6 +387,31 @@ chart.createTag({
383387
- `tagId` 标签的唯一标识,缺省则移除窗口上所有
384388

385389

390+
### createHtml(html, paneId)
391+
创建一个html元素,返回一个id。
392+
- `html` 元素 `{ id, position, content, style }`
393+
- `id` id
394+
- `position` 位置,类型为`yAxis``content`,默认为`content`
395+
- `style` html元素容器的样式,内联css样式
396+
- `content` 内容,可以是dom元素,也可以是dom元素组成的字符串
397+
- `paneId` 窗口id,默认为'candle_pane'
398+
示例:
399+
```javascript
400+
chart.createHtml({
401+
id: 'html_1',
402+
position: 'content',
403+
style: { zIndex: 12 },
404+
content: '<div>8888888</div>'
405+
}, 'candle_pane')
406+
```
407+
408+
409+
### removeHtml(paneId, htmlId)
410+
删除一个html元素
411+
- `paneId` 窗口id,缺省则删除所有
412+
- `htmlId` 创建时候的id,可以是单个id,也可以是id组成的数组,缺省则删除对应窗口上所有的
413+
414+
386415
### scrollByDistance(distance, animationDuration)
387416
滚动一定的距离。
388417
- `distance` 距离
@@ -433,13 +462,13 @@ chart.setPaneOptions({
433462

434463
### subscribeAction(type, callback)
435464
订阅图表动作。
436-
- `type` 类型是'zoom','scroll','crosshair'和'pane_drag'
465+
- `type` 类型是'zoom','scroll','crosshair', 'tooltip'和'pane_drag'
437466
- `callback` 是一个回调方法
438467

439468

440469
### unsubscribeAction(type, callback)
441470
取消订阅图表动作。
442-
- `type` 类型是'zoom','scroll','crosshair'和'pane_drag'
471+
- `type` 类型是'zoom','scroll','crosshair', 'tooltip'和'pane_drag'
443472
- `callback` 订阅时的回调方法,缺省则取消当前类型所有
444473

445474

docs/zh-CN/technical-indicator.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
// 技术指标名字,必要字段,是技术指标的唯一标识
2525
name: 'xxx',
2626

27+
// 用于提示显示
28+
shortName: 'xxx',
29+
2730
// 技术指标计算方法,必要字段
2831
// 该字段是一个回调方法,回调参数是当前图表的源数据和计算的参数,需要返回一个数组
2932
// kLineDataList 图表的原始数据
@@ -98,11 +101,11 @@
98101
// 基础比对数据,可缺省
99102
// 如果设置,当图形是bar时,将在此值上下绘制,如:MACD指标的macd值
100103
baseValue: null,
101-
// 可缺省,是个一个回调方法,可以根据回调参数来设置颜色,只有当type是'circle'和'bar'才会生效
102-
// 返回一个颜色值的字符串
104+
// 可缺省
105+
// 可以是一个固定的值,也可以是一个方法,如果是方法,需要返回一个颜色值的字符串
103106
color: (data, options) => {},
104-
// 可缺省,是个一个回调方法,可以根据回调参数来设置是否是空心,只有当type是'circle'和'bar'才会生效
105-
// 返回一个boolean值
107+
// 可缺省,只有当type是'circle'和'bar'才会生效
108+
// 可以是一个固定的boolean值,也可以是一个方法,如果是方法,需要返回一个boolean值
106109
isStroke: (data, options) => {}
107110
}
108111
```
@@ -129,6 +132,7 @@
129132
```javascript
130133
{
131134
name: 'MA',
135+
shortName: 'MA',
132136
calcParams: [5, 10],
133137
plots: [
134138
{ key: 'ma1', title: 'MA5: ', type: 'line' },

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "klinecharts",
3-
"version": "8.1.1",
3+
"version": "8.2.0",
44
"description": "Lightweight k-line chart built with html5 canvas",
55
"main": "index.js",
66
"types": "./types/index.d.ts",

0 commit comments

Comments
 (0)