Skip to content

Commit 0719f9e

Browse files
authored
Merge pull request #21 from TickPoints/dev
Update v0.1.9-beta
2 parents 42e1f15 + df5964e commit 0719f9e

7 files changed

Lines changed: 350 additions & 21 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mdbook-plotly"
3-
version = "0.1.9-alpha"
3+
version = "0.1.9-beta"
44
authors = ["TickPoints <tickpoints@outlook.com>"]
55
edition = "2024"
66
keywords = ["markdown", "mdbook"]

docs/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# CHANGELOG
22

3+
## v0.1.9-beta
4+
- Updated interfaces
5+
- Updated layout
6+
- Updated config
7+
- Updated legend
8+
- Updated the `Color`
9+
- Fixed docs
10+
311
## v0.1.9-alpha
412
- Updated Cargo.toml
513
- Adjusted deps

docs/USAGE-zh_CN.md

Lines changed: 124 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
- [桑基图](#data-sankey)
3333
- [地理散点图](#data-scatter_geo)
3434
- [Mapbox 散点图](#data-scatter_mapbox)
35+
- [极坐标散点图](#data-scatter_polar)
3536
- [Mapbox 密度热力图](#data-density_mapbox)
3637
- [表格](#data-table)
3738
- [SandBoxScript(已弃用)](#sand-box-script)
@@ -189,10 +190,9 @@ offline_js_sources = false
189190
- **Rgb**`"rgb(u8, u8, u8)"`(例如 `"rgb(0, 0, 0)"`
190191
- **Rgba**`"rgba(u8, u8, u8, f64)"`(例如 `"rgba(0, 0, 0, 0.0)"`
191192
- **Color** – 可以是:
192-
* 命名的 CSS 颜色:`{ named_color: "aliceblue" }`
193+
* 命名的 CSS 颜色:`"aliceblue"`
193194
* RGB 字符串:`"rgb(255, 0, 0)"`
194195
* RGBA 字符串:`"rgba(255, 0, 0, 0.5)"`
195-
* 或等效的对象形式:`{ rgb_color: "rgb(255,0,0)" }``{ rgba_color: "rgba(255,0,0,0.5)" }`
196196
197197
### 映射与生成器
198198
@@ -489,6 +489,10 @@ layout: {
489489
plot_background_color?: Color,
490490
// 分离器
491491
separators?: String,
492+
// 是否启用自动尺寸调整(默认 true)
493+
auto_size?: bool,
494+
// 图纸背景色(区别于 plot_background_color)
495+
paper_background_color?: Color,
492496

493497
// 说明器具体设置
494498
legend?: {
@@ -506,6 +510,38 @@ layout: {
506510
trace_group_gap?: usize,
507511
// 标题
508512
title?: String,
513+
// 图例项宽度(像素)
514+
item_width?: usize,
515+
516+
// 图例中 trace 的显示顺序
517+
// "normal": 正常顺序
518+
// "reversed": 倒序
519+
// "grouped": 按组显示
520+
// "reversed+grouped": 倒序分组
521+
trace_order?: "normal" | "reversed" | "grouped" | "reversed+grouped",
522+
523+
// 图例项尺寸模式
524+
// "trace": 按 trace 宽度
525+
// "constant": 恒定宽度
526+
item_sizing?: "trace" | "constant",
527+
528+
// 单击图例项的效果
529+
// "toggle": 切换该 trace
530+
// "toggleothers": 切换其他 trace
531+
// "false": 无操作
532+
item_click?: "toggle" | "toggleothers" | "false",
533+
534+
// 双击图例项的效果(取值同 item_click)
535+
item_double_click?: "toggle" | "toggleothers" | "false",
536+
537+
// 图例文本垂直对齐
538+
// "top": 顶对齐 / "middle": 居中 / "bottom": 底对齐
539+
valign?: "top" | "middle" | "bottom",
540+
541+
// 单击图例分组的效果
542+
// "toggleitem": 切换组内所有项
543+
// "togglegroup": 切换整个组
544+
group_click?: "toggleitem" | "togglegroup",
509545
},
510546

511547
// 图表边缘具体设置
@@ -575,6 +611,22 @@ config: {
575611
display_logo?: bool,
576612
// 使用公司标志对图像进行水印处理
577613
watermark?: bool,
614+
615+
// 控制模式栏的显示行为
616+
// "hover": 仅悬停时显示
617+
// "true": 始终显示(默认)
618+
// "false": 不显示
619+
display_mode_bar?: "hover" | "true" | "false",
620+
621+
// 双击图表的响应行为
622+
// "false": 无操作
623+
// "reset": 重置视图
624+
// "autosize": 自动调整大小
625+
// "reset+autosize": 重置并自动调整
626+
double_click?: "false" | "reset" | "autosize" | "reset+autosize",
627+
628+
// 是否显示“在 Chart Studio 中编辑”链接(show_link 的别名)
629+
show_edit_in_chart_studio?: bool,
578630
}
579631
```
580632
@@ -1108,6 +1160,76 @@ config: {
11081160
}
11091161
```
11101162
1163+
### Data-scatter_polar
1164+
`scatter_polar`可以是一个`Data`。该`Data`将被渲染为极坐标散点图。
1165+
```json5
1166+
{
1167+
type: "scatter_polar",
1168+
1169+
// 角度坐标(单位:度,除非布局中指定了其他单位)
1170+
theta: [f64; usize],
1171+
// 径向坐标
1172+
r: [f64; usize],
1173+
1174+
// trace 名称,显示在图例和悬停信息中
1175+
name?: String,
1176+
// 是否在图例中显示此 trace
1177+
show_legend?: bool,
1178+
// 图例分组标识
1179+
legend_group?: String,
1180+
// 不透明度,0(透明)~ 1(不透明)
1181+
opacity?: f64,
1182+
// 数据点上显示的统一文本
1183+
text?: String,
1184+
// 为每个数据点单独设置显示文本
1185+
text_array?: [String; usize],
1186+
// 悬停时显示的统一文本
1187+
hover_text?: String,
1188+
// 为每个数据点单独设置悬停文本
1189+
hover_text_array?: [String; usize],
1190+
// 悬停标签模板
1191+
hover_template?: String,
1192+
// 为每个数据点单独设置悬停模板
1193+
hover_template_array?: [String; usize],
1194+
// 指定使用的极坐标子图(如 "polar""polar2"
1195+
subplot?: String,
1196+
// 是否连接缺失数据点之间的间隙
1197+
connect_gaps?: bool,
1198+
// 径向坐标的参考起始值(与 dr 配合,将数组索引映射为实际径向距离)
1199+
r0?: f64,
1200+
// 径向步长
1201+
dr?: f64,
1202+
// 角度坐标的参考起始值(度)
1203+
theta0?: f64,
1204+
// 角度步长(度)
1205+
dtheta?: f64,
1206+
// 填充类型
1207+
// "tozeroy": 填充到 r=0
1208+
// "tozerox": 填充到 theta=0
1209+
// "tonexty": 填充到下一个 trace 的 r 值
1210+
// "tonextx": 填充到下一个 trace 的 theta 值
1211+
// "toself": 填充封闭区域自身
1212+
// "tonext": 填充到下一个 trace
1213+
// "none": 不填充
1214+
fill?: "tozeroy" | "tozerox" | "tonexty" | "tonextx" | "toself" | "tonext" | "none",
1215+
// 绘制模式
1216+
// "lines": 折线
1217+
// "markers": 散点标记
1218+
// "text": 仅文本
1219+
// "linesmarkers": 折线 + 标记
1220+
// "linestext": 折线 + 文本
1221+
// "markerstext": 标记 + 文本
1222+
// "linemarkerstext": 折线 + 标记 + 文本
1223+
// "none": 不显示
1224+
mode?: "lines" | "markers" | "text" | "linesmarkers" | "linestext" | "markerstext" | "linemarkerstext" | "none",
1225+
// 可见性控制
1226+
// "true": 可见(默认)
1227+
// "false": 不可见
1228+
// "legendonly": 不绘制但在图例中显示
1229+
visible?: "true" | "false" | "legendonly",
1230+
}
1231+
```
1232+
11111233
### Data-scatter
11121234
`scatter`可以是一个`Data`。该`Data`将会被渲染为填充区域图。
11131235
```json5

docs/USAGE.md

Lines changed: 128 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ This is the official user manual (English edition) for **mdbook-plotly**, a prep
3232
- [Sankey Diagrams](#data-sankey)
3333
- [Geographic Scatter Plots](#data-scatter_geo)
3434
- [Mapbox Scatter Plots](#data-scatter_mapbox)
35+
- [Polar Scatter Plots](#data-scatter_polar)
3536
- [Mapbox Density Heatmaps](#data-density_mapbox)
3637
- [Tables](#data-table)
3738
- [SandBoxScript (Deprecated)](#sand-box-script)
@@ -189,10 +190,9 @@ The following notation is used throughout this reference to describe expected ty
189190
- **Rgb**`"rgb(u8, u8, u8)"` (e.g., `"rgb(0, 0, 0)"`)
190191
- **Rgba**`"rgba(u8, u8, u8, f64)"` (e.g., `"rgba(0, 0, 0, 0.0)"`)
191192
- **Color** – can be one of the following:
192-
- A named CSS color: `{ named_color: "aliceblue" }`
193-
- An RGB color: `{ rgb_color: "rgb(255, 0, 0)" }`
194-
- An RGBA color: `{ rgba_color: "rgba(255, 0, 0, 0.5)" }`
195-
- Alternatively, for RGB and RGBA, you can use the plain string forms `"rgb(255,0,0)"` or `"rgba(255,0,0,0.5)"` directly.
193+
- A named CSS color: `"aliceblue"`
194+
- An RGB color: `"rgb(255, 0, 0)"`
195+
- An RGBA color: `"rgba(255, 0, 0, 0.5)"`
196196
197197
### Map and Generators
198198
@@ -497,6 +497,10 @@ layout: {
497497
plot_background_color?: Color,
498498
// Separators
499499
separators?: String,
500+
// Whether to enable automatic size adjustment (default true)
501+
auto_size?: bool,
502+
// Paper background colour (distinct from plot_background_color)
503+
paper_background_color?: Color,
500504
501505
// Legend configuration
502506
legend?: {
@@ -514,6 +518,38 @@ layout: {
514518
trace_group_gap?: usize,
515519
// Title
516520
title?: String,
521+
// Width of each legend item (pixels)
522+
item_width?: usize,
523+
524+
// Trace display order within the legend
525+
// "normal": natural order
526+
// "reversed": reversed order
527+
// "grouped": grouped by trace group
528+
// "reversed+grouped": reversed and grouped
529+
trace_order?: "normal" | "reversed" | "grouped" | "reversed+grouped",
530+
531+
// Legend item sizing mode
532+
// "trace": sized per trace
533+
// "constant": constant width
534+
item_sizing?: "trace" | "constant",
535+
536+
// Single-click behaviour on legend items
537+
// "toggle": toggle the trace
538+
// "toggleothers": toggle all other traces
539+
// "false": no action
540+
item_click?: "toggle" | "toggleothers" | "false",
541+
542+
// Double-click behaviour on legend items (same values as item_click)
543+
item_double_click?: "toggle" | "toggleothers" | "false",
544+
545+
// Vertical alignment of legend text
546+
// "top", "middle", "bottom"
547+
valign?: "top" | "middle" | "bottom",
548+
549+
// Click behaviour on legend groups
550+
// "toggleitem": toggle all items in the group
551+
// "togglegroup": toggle the group
552+
group_click?: "toggleitem" | "togglegroup",
517553
},
518554
519555
// Chart margin configuration
@@ -549,9 +585,6 @@ config: {
549585
editable?: bool,
550586
// Whether auto-sizing is enabled
551587
autosizable?: bool,
552-
// Whether to resize the layout when the window is resized
553-
// WARNING: This option currently has no practical effect.
554-
responsive?: bool,
555588
// Whether to fill the screen
556589
// NOTE: Only effective when `autosizable` is `true`.
557590
fill_frame?: bool,
@@ -583,6 +616,22 @@ config: {
583616
display_logo?: bool,
584617
// Watermark the image with a company logo
585618
watermark?: bool,
619+
620+
// Controls when the modebar appears
621+
// "hover": only show on hover
622+
// "true": always show (default)
623+
// "false": never show
624+
display_mode_bar?: "hover" | "true" | "false",
625+
626+
// Double-click behaviour
627+
// "false": no action
628+
// "reset": reset the chart view
629+
// "autosize": autosize
630+
// "reset+autosize": reset and autosize
631+
double_click?: "false" | "reset" | "autosize" | "reset+autosize",
632+
633+
// Whether to show an "Edit in Chart Studio" link (alias for show_link)
634+
show_edit_in_chart_studio?: bool,
586635
}
587636
```
588637
@@ -1127,6 +1176,78 @@ config: {
11271176
}
11281177
```
11291178
1179+
### Data-scatter_polar
1180+
1181+
`scatter_polar` can be a `Data` entry. This `Data` will be rendered as a scatter plot in polar coordinates.
1182+
1183+
```json5
1184+
{
1185+
type: "scatter_polar",
1186+
1187+
// Angular coordinates (degrees unless layout.polar.angularaxis.thetaunit is overridden)
1188+
theta: [f64; usize],
1189+
// Radial coordinates
1190+
r: [f64; usize],
1191+
1192+
// Trace name, displayed in legend and hover info
1193+
name?: String,
1194+
// Whether to show this trace in the legend
1195+
show_legend?: bool,
1196+
// Legend group identifier
1197+
legend_group?: String,
1198+
// Opacity, from 0 (transparent) to 1 (opaque)
1199+
opacity?: f64,
1200+
// Uniform text displayed on data points
1201+
text?: String,
1202+
// Per-point text
1203+
text_array?: [String; usize],
1204+
// Uniform hover text
1205+
hover_text?: String,
1206+
// Per-point hover text
1207+
hover_text_array?: [String; usize],
1208+
// Hover label template
1209+
hover_template?: String,
1210+
// Per-point hover template
1211+
hover_template_array?: [String; usize],
1212+
// Polar subplot to use (e.g. "polar", "polar2")
1213+
subplot?: String,
1214+
// Whether to connect gaps between missing data points
1215+
connect_gaps?: bool,
1216+
// Reference start value for radial coordinates (used to map array indices to radial distance)
1217+
r0?: f64,
1218+
// Radial step (used with r0)
1219+
dr?: f64,
1220+
// Reference start value for angular coordinates (degrees)
1221+
theta0?: f64,
1222+
// Angular step (degrees)
1223+
dtheta?: f64,
1224+
// Fill style
1225+
// "tozeroy": fill to r=0
1226+
// "tozerox": fill to theta=0
1227+
// "tonexty": fill to next trace's r values
1228+
// "tonextx": fill to next trace's theta values
1229+
// "toself": fill enclosed area
1230+
// "tonext": fill to next trace
1231+
// "none": no fill
1232+
fill?: "tozeroy" | "tozerox" | "tonexty" | "tonextx" | "toself" | "tonext" | "none",
1233+
// Drawing mode
1234+
// "lines": lines only
1235+
// "markers": markers only
1236+
// "text": text only
1237+
// "linesmarkers": lines + markers
1238+
// "linestext": lines + text
1239+
// "markerstext": markers + text
1240+
// "linemarkerstext": lines + markers + text
1241+
// "none": hidden
1242+
mode?: "lines" | "markers" | "text" | "linesmarkers" | "linestext" | "markerstext" | "linemarkerstext" | "none",
1243+
// Visibility control
1244+
// "true": visible (default)
1245+
// "false": hidden
1246+
// "legendonly": not drawn but shown in legend
1247+
visible?: "true" | "false" | "legendonly",
1248+
}
1249+
```
1250+
11301251
### Data-scatter
11311252
11321253
`scatter` can be a `Data` entry. This `Data` will be rendered as a filled area chart.

0 commit comments

Comments
 (0)