Package com.oorian.chartjs
Class ChartJs
java.lang.Object
com.oorian.chartjs.ChartJs
Entry point class for the Chart.js library integration with Oorian.
This class provides static methods to configure resource paths and add required JavaScript files to the HTML head section.
Basic Usage:
// In your page's createHead method:
ChartJs.addAllResources(head);
Custom Paths:
// Set custom paths before adding resources
ChartJs.setChartJsRootPath("/assets/chartjs");
ChartJs.setOorianChartJsPath("/assets/oorian");
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddAllResources(com.oorian.html.elements.Head head) Adds all required Chart.js resources to the HTML head.static voidaddChartJsJavascript(com.oorian.html.elements.Head head) Adds all required Chart.js JavaScript files to the HTML head.static StringGets the full path to the Chart.js main JavaScript file.static StringGets the full path to the Oorian-ChartJs bridge script.static voidinitialize(com.oorian.html.HtmlPage page) Initializes Chart.js for the given page.static voidsetChartJsRootPath(String chartJsRootPath) Sets the root path for Chart.js resources.static voidsetOorianChartJsPath(String oorianChartJsPath) Sets the path where the Oorian-ChartJs bridge script is located.
-
Constructor Details
-
ChartJs
public ChartJs()
-
-
Method Details
-
setOorianChartJsPath
Sets the path where the Oorian-ChartJs bridge script is located.- Parameters:
oorianChartJsPath- The path to the oorian.chartjs.js file
-
setChartJsRootPath
Sets the root path for Chart.js resources.- Parameters:
chartJsRootPath- The root path (e.g., "/chartjs")
-
getOorianChartJs
Gets the full path to the Oorian-ChartJs bridge script.- Returns:
- The path to oorian.chartjs.js
-
getChartJs
Gets the full path to the Chart.js main JavaScript file.- Returns:
- The path to the Chart.js script
-
addChartJsJavascript
public static void addChartJsJavascript(com.oorian.html.elements.Head head) Adds all required Chart.js JavaScript files to the HTML head.This includes:
- Chart.js main script (chart.min.js)
- Oorian-ChartJs bridge (oorian.chartjs.js)
- Parameters:
head- The HTML head element
-
addAllResources
public static void addAllResources(com.oorian.html.elements.Head head) Adds all required Chart.js resources to the HTML head.Chart.js does not require CSS files, so this method only adds JavaScript.
- Parameters:
head- The HTML head element
-
initialize
public static void initialize(com.oorian.html.HtmlPage page) Initializes Chart.js for the given page. Adds all required resources to the page head and the initialization script to the body. This method is safe to call multiple times; the init script will only be added once.- Parameters:
page- The page to initialize Chart.js on.
-