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 TypeMethodDescriptionvoidaddCustomStringAttribute(String name, String value) Adds a string attribute to the object.
The value will be wrapped in quotes and escaped.voidaddRawAttribute(String name, 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.
-
Method Details
-
addRawAttribute
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 attributevalue- value of attribute
-
addCustomStringAttribute
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:
This would be equivalent to the following JavaScript code:$!chart.yAxis().addCustomStringAttribute("tooltipValueFormat", "{value:%Y-%m-%d}")yAxis: { tooltipValueFormat: '{value:%Y-%m-%d}' }- Parameters:
name- name of attributevalue- string value of attribute- Since:
- 3.9.2
-