title: Object

Title allows you to set the content, appearance and position of StockChart’s title.

StockChart can have only one title element. But you can define multiple subtitles in the StockChart. Subtitles have same attribute except by default it is displayed in smaller font size. At the same time, you can have title & subtitles to individual charts as well.

var stockChart = new CanvasJS.StockChart("container",
{
 .
 .
 title: {
   text: "StockChart Title"
 },
 .
 . 
});
stockChart.render();

Simple Title Attributes

Applies To Attribute Type Default Options/Examples
title backgroundColor String null “red”, “rgb(255,0,0)”, “#dedede”, …
title borderColor String “black” “red”, “rgb(255,0,0)”, “#dedede”, …
title borderThickness Number 0 2, 4, …
title cornerRadius String 0 2, 4, …
title fontColor String “#3A3A3A” “red”, “rgb(255,0,0)”, “#dedede”, …
title fontFamily String “Calibri, Optima, Candara, Verdana, Geneva, sans-serif” “arial”, “verdana”, …
title fontSize Number Auto. Calculated 14, 16, …
title fontStyle String ““normal”” “normal”,“italic”, “oblique”
title fontWeight String “bold” “lighter”, “normal, “bold”, “bolder”
title horizontalAlign String ““center”” “left”, “center”, “right”
title margin Number 10 4, 8, …
title padding Number 0 1, 3, …
title text String null “Stock Chart Title”, “Bitcoin Stock Chart”, …
title verticalAlign String “top” “top”, “center”, “bottom”
title wrap Boolean true true, false
title maxWidth Number Automatically calculated based on the chart size. 200, 400, …
title 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