Skip to content

Commit 6c63c5b

Browse files
committed
[add] data export guide for chart, update grid data export docs
1 parent 6672b00 commit 6c63c5b

File tree

7 files changed

+55
-16
lines changed

7 files changed

+55
-16
lines changed

docs/chart/api/export/chart_pdf_method.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ chart.export.pdf()
5656
// export with config settings
5757
chart.export.pdf({
5858
url: "https://export.dhtmlx.com/chart/pdf/9.3.0",
59-
name:"result.pdf"
59+
name: "result.pdf"
6060
})
6161
.then(() => console.log("success"))
6262
.catch(() => console.log("failure"))
@@ -84,9 +84,9 @@ It is necessary to set sufficient margin for correct display of `headerTemplate`
8484
| "A5" | (5.83in x 8.27in) |
8585
| "A6" | (4.13in x 5.83in) |
8686

87-
**Related samples**: [Chart. Export. Export to PDF/PNG](https://snippet.dhtmlx.com/4rybsjjq)
87+
**Related samples**: [Chart. Export to PDF/PNG](https://snippet.dhtmlx.com/4rybsjjq)
8888

89-
**Related API:** [exportStyles](chart/api/chart_exportstyles_config.md)
89+
**Related API:** [`exportStyles`](chart/api/chart_exportstyles_config.md)
9090

9191
**Change log:**
9292

docs/chart/api/export/chart_png_method.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ chart.export.png({
4040

4141
@descr:
4242

43-
**Related samples**: [Chart. Export. Export to PDF/PNG](https://snippet.dhtmlx.com/4rybsjjq)
43+
**Related samples**: [Chart. Export to PDF/PNG](https://snippet.dhtmlx.com/4rybsjjq)
4444

45-
**Related API:** [exportStyles](chart/api/chart_exportstyles_config.md)
45+
**Related API:** [`exportStyles`](chart/api/chart_exportstyles_config.md)
4646

4747
**Change log:**
4848

docs/chart/features.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ In this section you will know how to export Chart to different formats.
121121

122122
| Topic | Description |
123123
| :----------------------------------------------------------------- | :----------------------------------------------------------------------------------------------- |
124-
| [Exporting Chart to a PDF or PNG file](category/export-methods.md) | Learn how to export Chart to PDF or PNG formats ([Example](https://snippet.dhtmlx.com/4rybsjjq)) |
124+
| [Exporting Chart to a PDF or PNG file](../usage/#exporting-data) | Learn how to export Chart to PDF or PNG formats ([Example](https://snippet.dhtmlx.com/4rybsjjq)) |
125125

126126
## How to work with Chart events
127127

@@ -150,7 +150,7 @@ In this section you will learn about common functionality of the library which c
150150
| ------------------------------------------------------------- | ------------------------------------------------------------- |
151151
| [Touch support](../../common_features/touch_support/) | Learn how to work with touch support |
152152
| [TypeScript support](../../common_features/using_typescript/) | Learn how to work with TypeScript |
153-
| [AwaitRedraw](../../helpers/await_redraw/) | Learn how to perform the code after the components rendering |
153+
| [AwaitRedraw](../../helpers/await_redraw/) | Learn how to perform the code after the component's rendering |
154154

155155
## Any questions left?
156156

docs/chart/usage.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,38 @@ The method takes as a parameter an object with two properties:
174174
A new data item is added relative to the X-axis. In case of adding many items, you need to increase the value of each new data item position to add it correctly.
175175

176176
**Related sample**: [Chart. Adding data on the fly](https://snippet.dhtmlx.com/dpz4w5nr)
177+
178+
## Exporting data
179+
180+
You can export data of Chart into the PDF or PNG format via the corresponding methods of the `Export` module.
181+
182+
### Exporting data to PDF
183+
184+
The [`pdf()`](chart/api/export/chart_pdf_method.md) method of the Export module allows you to export Chart data into a PDF file. The method takes an [object with the export settings](chart/api/export/chart_pdf_method.md) as a parameter (all settings are optional) and returns a promise of data export.
185+
186+
~~~jsx
187+
chart.export.pdf({
188+
url: "https://export.dhtmlx.com/chart/pdf/9.3.0",
189+
name: "result.pdf"
190+
})
191+
.then(() => console.log("success"))
192+
.catch(() => console.log("failure"))
193+
.finally(() => console.log("finished"));
194+
~~~
195+
196+
**Related sample**: [Chart. Export to PDF/PNG](https://snippet.dhtmlx.com/4rybsjjq)
197+
198+
### Exporting data to PNG
199+
200+
The [`png()`](chart/api/export/chart_png_method.md) method of the Export module allows you to export data from Chart into a PNG file. The method takes an [object with export settings](chart/api/export/chart_png_method.md) as a parameter (all settings are optional) and returns a promise of data export.
201+
202+
~~~jsx
203+
chart.export.png({
204+
theme: "dark" // the exported theme, "light" by default
205+
})
206+
.then(() => console.log("success"))
207+
.catch(() => console.log("failure"))
208+
.finally(() => console.log("finished"));
209+
~~~
210+
211+
**Related sample**: [Chart. Export to PDF/PNG](https://snippet.dhtmlx.com/4rybsjjq)

docs/grid/api/export/grid_pdf_method.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,12 @@ grid.export.pdf()
6060

6161
// export with config settings
6262
grid.export.pdf({
63-
format: "A4",
64-
scale: 0.75,
65-
displayHeaderFooter: true,
66-
theme: "dark",
63+
pdf: {
64+
format: false, // the format of the output file, "A4" by default
65+
scale: 0.75, // the scale of the grid rendering (between 0.1 and 2)
66+
displayHeaderFooter: true // defines whether to display the header and footer, false by default
67+
},
68+
theme: "dark" // the exported theme, "light" by default
6769
})
6870
.then(() => console.log("success"))
6971
.catch(() => console.log("failure"))
@@ -100,7 +102,7 @@ If you use Grid in conjunction with [Pagination](pagination.md), only the displa
100102

101103
**Related article:** [Exporting Grid](grid/usage.md)
102104

103-
**Related API:** [exportStyles](grid/api/grid_exportstyles_config.md)
105+
**Related API:** [`exportStyles`](grid/api/grid_exportstyles_config.md)
104106

105107
**Change log:**
106108

docs/grid/api/export/grid_png_method.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ If you use Grid in conjunction with [Pagination](pagination.md), only the displa
5252

5353
**Related article:** [Exporting Grid](grid/usage.md)
5454

55-
**Related API:** [exportStyles](grid/api/grid_exportstyles_config.md)
55+
**Related API:** [`exportStyles`](grid/api/grid_exportstyles_config.md)
5656

5757
**Change log:**
5858

docs/grid/usage.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -541,9 +541,11 @@ The [`pdf()`](grid/api/export/grid_pdf_method.md) method of the Export module al
541541

542542
~~~jsx
543543
grid.export.pdf({
544-
format: "A4", // the format of the output file, "A4" by default
545-
scale: 0.75, // the scale of the grid rendering (between 0.1 and 2)
546-
displayHeaderFooter: true, // defines whether to display the header and footer, false by default
544+
pdf: {
545+
format: false, // the format of the output file, "A4" by default
546+
scale: 0.75, // the scale of the grid rendering (between 0.1 and 2)
547+
displayHeaderFooter: true // defines whether to display the header and footer, false by default
548+
},
547549
theme: "dark" // the exported theme, "light" by default
548550
})
549551
.then(() => console.log("success"))

0 commit comments

Comments
 (0)