Interface GenericHcObject

All Known Subinterfaces:
CommonHighchartBuilder, CustomHighchartBuilder, HcAxis, HcChart, HcCredits, HcExporting, HcLegend, HcMarker, HcOptions3d, HcPieDataLabels, HcPiePlotOptions, HcPlotOptions, HcSerie, HcSerieDataObject, HcSeriesDataLabels, HcSeriesPlotOptions, HcTooltip, HighchartBuilder

public interface GenericHcObject
Since:
3.9.0
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds a string attribute to the object.
    The value will be wrapped in quotes and escaped.
    void
    Adds a raw Javascript attribute to the object.
    (See addCustomStringAttribute, to add string values.)
    This method adds a raw attribute, meaning the value will NOT be wrapped in quotes and will NOT be escaped.
    This is useful for adding complex JavaScript objects or structures as attribute values.
  • Method Details

    • addRawAttribute

      void addRawAttribute(@NotNull String name, @NotNull String value)
      Adds a raw Javascript attribute to the object.
      (See addCustomStringAttribute, to add string values.)
      This method adds a raw attribute, meaning the value will NOT be wrapped in quotes and will NOT be escaped.
      This is useful for adding complex JavaScript objects or structures as attribute values.

      For example, to set the "min" attribute of the Y-Axis of your chart, you can use Velocity code:

       $!chart.yAxis().addRawAttribute("min", "0")
       

      This would be equivalent to the following JavaScript code:

       yAxis: {
           min: 0
       }
       

      Another example for setting plot options for an "area" chart:

       $!chart.build().plotOptions().addRawAttribute("area", "{stacking: 'normal', marker: {enabled: false}}")
       

      This would be equivalent to the following JavaScript code:

       plotOptions: {
           area: {stacking: 'normal', marker: {enabled: false}}
       }
       
      Parameters:
      name - name of attribute
      value - value of attribute
    • addCustomStringAttribute

      void addCustomStringAttribute(@NotNull String name, @NotNull String value)
      Adds a string attribute to the object.
      The value will be wrapped in quotes and escaped. This is typically used for attributes that require string values.

      For example, to set the "tooltipValueFormat" attribute of the Y-Axis of your chart, you can use Velocity code:

       $!chart.yAxis().addCustomStringAttribute("tooltipValueFormat", "{value:%Y-%m-%d}")
       
      This would be equivalent to the following JavaScript code:
       yAxis: {
           tooltipValueFormat: '{value:%Y-%m-%d}'
       }
       
      Parameters:
      name - name of attribute
      value - string value of attribute
      Since:
      3.9.2