Html
chartjs: Html
A parent class for generating HMTL code.
Do NOT use this class directly! This class acts as a parent class for inheriting methods to the Chart classes for generating HTML code.
To view a Chart object in your web browser, use its webserve
method.
See also: BarChart, BubbleChart, DoughnutChart, LineChart, PieChart, PolarAreaChart, RadarChart, ScatterChart
Source Code: Html
The Html class offers the following public methods:
chartjs: json = jsonstring (obj)
jsonstring (obj) returns a character vector, json,
holding the Chart.js configuration of a Chart object in JSON.
See also: BarChart, BubbleChart, DoughnutChart, LineChart, PieChart, PolarAreaChart, RadarChart, ScatterChart
chartjs: html = htmlstring (obj)
chartjs: html = htmlstring (obj, source)
htmlstring (obj) returns a character vector defining the
HTML code to display a Chart object on a web browser. Use the
webserve method to view it in your web browser.
htmlstring (obj, source) also sets where the page
loads the Chart.js library from, as one of the following.
| source | Chart.js is loaded | |
|---|---|---|
"inline" | from a copy written into the page, the default. The page opens without a network connection and never changes. | |
"cdn" | from the jsDelivr CDN, pinned to the release bundled with the package and checked against its hash, so that the browser runs nothing else. | |
| a URL | from source, such as
"/static/chart.umd.min.js" on a server that hosts the file. A
URL holds a / or ends in .js. |
See also: BarChart, BubbleChart, DoughnutChart, LineChart, PieChart, PolarAreaChart, RadarChart, ScatterChart
chartjs: htmlsave (obj, filename)
chartjs: htmlsave (obj, filename, source)
htmlsave (obj, filename) saves the HTML code
describing a Chart object to a file. The HTML code is identical to that
generated by the htmlstring method, and source sets where
it loads Chart.js from in the same way.
See also: BarChart, BubbleChart, DoughnutChart, LineChart, PieChart, PolarAreaChart, RadarChart, ScatterChart
chartjs: webserve (obj)
chartjs: webserve (obj, filename)
chartjs: webserve (obj, filename, source)
webserve (obj) saves the HTML code describing the Chart
object to a temporary file and opens it in your system’s web browser.
No web server is involved: the page is opened from the file.
webserve (obj, filename) saves the HTML code to
filename instead, so that the page can be kept and opened again.
Calling it again with the same filename and reloading the page in
the browser shows the updated chart. An empty filename uses a
temporary file.
webserve (obj, filename, source) sets where the
page loads Chart.js from, as in htmlstring.
See also: BarChart, BubbleChart, DoughnutChart, LineChart, PieChart, PolarAreaChart, RadarChart, ScatterChart