subtitles: Array

subtitles is a collection of subtitle elements and enables user to display any number of subtitles in the StockChart.

subtitle: Object

Subtitle allows you to set the content, appearance and position of StockChart’s subtitle. Subtitle is similar to title except it has smaller font size by default. In cases where vertical align and horizontal align of both title and subtitle are same, then subtitle is rendered below the main title.

var stockChart = new CanvasJS.StockChart("container",
{
 .
 .
 subtitles: [
   { // subtitle 1
   },
   { // subtitle 2
   },
   .
 ],
 .
}); 
stockChart.render();

Simple subtitle Attributes

Note
  • Subtitle properties are identical to title object. Hence all the links mentioned below will be redirected to corresponding pages in Title.
Applies To Attribute Type Default Options/Examples
subtitle backgroundColor String null “red”, “blue”, “FF0000”, …
subtitle borderColor String “black” “red”, “blue”, “FF0000”, …
subtitle borderThickness Number 0 2, 4, 6, …
subtitle cornerRadius Number 0 3, 7, 9, …
subtitle fontColor String “#3A3A3A” “red”, “blue”, “FF0000”, …
subtitle fontFamily String “Calibri, Optima, Candara, Verdana, Geneva, sans-serif” “arial”, “tohoma”, “verdana”, …
subtitle fontSize Number Auto. Calculated 25, 30, …
subtitle fontStyle String ““normal”” “normal”, “italic”, “oblique”
subtitle fontWeight String “bold” “lighter”, “normal”, “bold”, “bolder”
subtitle horizontalAlign String ““center”” “left”, “center”, “top”
subtitle margin Number 10 4, 8, 12, …
subtitle padding Number 0 5, 8, …
subtitle text String null “Stock Chart Subtitle”, “Bitcoin Closing Price”, …
subtitle verticalAlign String “top” “top”, “center”, “bottom”
subtitle wrap Boolean true true, false
subtitle maxWidth Number Automatically calculated based on the Stock Chart Size 100, 200, 300, …
subtitle textAlign String Depends on horizontalAlign. “left”, “center” ,”right”

Try Editing The Code

  Also See:    


If you have any questions, please feel free to ask in our forums.Ask Question