Class ChartJs

java.lang.Object
com.oorian.chartjs.ChartJs

public class ChartJs extends Object
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 Details

    • ChartJs

      public ChartJs()
  • Method Details

    • setOorianChartJsPath

      public static void setOorianChartJsPath(String oorianChartJsPath)
      Sets the path where the Oorian-ChartJs bridge script is located.
      Parameters:
      oorianChartJsPath - The path to the oorian.chartjs.js file
    • setChartJsRootPath

      public static void setChartJsRootPath(String chartJsRootPath)
      Sets the root path for Chart.js resources.
      Parameters:
      chartJsRootPath - The root path (e.g., "/chartjs")
    • getOorianChartJs

      public static String getOorianChartJs()
      Gets the full path to the Oorian-ChartJs bridge script.
      Returns:
      The path to oorian.chartjs.js
    • getChartJs

      public static String 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.