you can specify the height and width of the graph in the code, that way when the graph renders in a hidden div it will have the proper height and width. You can only specify in pixels though and not percent.
{ height: 550, //in pixels width: 600, zoomEnabled: true, colorSet: "colorSet", title:{ fontSize: 30, text: "Activity", },
You can create a line chart with different colors using canvasjs, you just create a multi-series graph and each data series can have a different color that you can specify.
pro-tip: if you load the charts when they are display:none, their size will be messed up (if you re-size the window it fixes it). If you have to load the chart when its display:none, you can explicitly add height and width in the init code (although percentage doesn’t work):
var chart = new CanvasJS.Chart("chartContainer", { height: 550, //in pixels width: 600, title:{ text: "Earthquakes - per month" },