0
Guys, my . html Component is like this:
<script>
window.onload = function () {
var chart = new CanvasJS.Chart("chartContainer", {
animationEnabled: true,
title:{
text: "Monthly Expenses, 2016-17"
},
axisY :{
includeZero: false,
prefix: "$"
},
toolTip: {
shared: true
},
legend: {
fontSize: 13
},
data: [{
type: "splineArea",
showInLegend: true,
name: "Salaries",
yValueFormatString: "$#,##0",
xValueFormatString: "MMM YYYY",
dataPoints: [
{ x: new Date(2016, 2), y: 30000 },
{ x: new Date(2016, 3), y: 35000 },
{ x: new Date(2016, 4), y: 30000 },
{ x: new Date(2016, 5), y: 30400 },
{ x: new Date(2016, 6), y: 20900 },
{ x: new Date(2016, 7), y: 31000 },
{ x: new Date(2016, 8), y: 30200 },
{ x: new Date(2016, 9), y: 30000 },
{ x: new Date(2016, 10), y: 33000 },
{ x: new Date(2016, 11), y: 38000 },
{ x: new Date(2017, 0), y: 38900 },
{ x: new Date(2017, 1), y: 39000 }
]
},
{
type: "splineArea",
showInLegend: true,
name: "Office Cost",
yValueFormatString: "$#,##0",
dataPoints: [
{ x: new Date(2016, 2), y: 20100 },
{ x: new Date(2016, 3), y: 16000 },
{ x: new Date(2016, 4), y: 14000 },
{ x: new Date(2016, 5), y: 18000 },
{ x: new Date(2016, 6), y: 18000 },
{ x: new Date(2016, 7), y: 21000 },
{ x: new Date(2016, 8), y: 22000 },
{ x: new Date(2016, 9), y: 25000 },
{ x: new Date(2016, 10), y: 23000 },
{ x: new Date(2016, 11), y: 25000 },
{ x: new Date(2017, 0), y: 26000 },
{ x: new Date(2017, 1), y: 25000 }
]
},
{
type: "splineArea",
showInLegend: true,
name: "Entertainment",
yValueFormatString: "$#,##0",
dataPoints: [
{ x: new Date(2016, 2), y: 10100 },
{ x: new Date(2016, 3), y: 6000 },
{ x: new Date(2016, 4), y: 3400 },
{ x: new Date(2016, 5), y: 4000 },
{ x: new Date(2016, 6), y: 9000 },
{ x: new Date(2016, 7), y: 3900 },
{ x: new Date(2016, 8), y: 4200 },
{ x: new Date(2016, 9), y: 5000 },
{ x: new Date(2016, 10), y: 14300 },
{ x: new Date(2016, 11), y: 12300 },
{ x: new Date(2017, 0), y: 8300 },
{ x: new Date(2017, 1), y: 6300 }
]
},
{
type: "splineArea",
showInLegend: true,
yValueFormatString: "$#,##0",
name: "Maintenance",
dataPoints: [
{ x: new Date(2016, 2), y: 1700 },
{ x: new Date(2016, 3), y: 2600 },
{ x: new Date(2016, 4), y: 1000 },
{ x: new Date(2016, 5), y: 1400 },
{ x: new Date(2016, 6), y: 900 },
{ x: new Date(2016, 7), y: 1000 },
{ x: new Date(2016, 8), y: 1200 },
{ x: new Date(2016, 9), y: 5000 },
{ x: new Date(2016, 10), y: 1300 },
{ x: new Date(2016, 11), y: 2300 },
{ x: new Date(2017, 0), y: 2800 },
{ x: new Date(2017, 1), y: 1300 }
]
}]
});
chart.render();
}
<div class="container-fluid">
<div class="row mb-4">
<div class="col-md-4 padding">
<div class="mod shadow">
<h6>Moderações - 5213</h6>
<!-- Tentativa Charts -->
<div id="chartContainer" style="height: 250px; width: 200px;"></div>
<script type="text/javascript" src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<!-- Fim Charts -->
</div>
</div>
<div class="col-md-4 padding">
<div class="modUser shadow">
<h6>Moderações por Usuário - 2603</h6>
</div>
</div>
<div class="col-md-4 padding">
<div class="modCat shadow">
<h6>Moderações por Categoria - 2603</h6>
</div>
</div>
</div>
<div class="row mb-4">
<div class="col-md-12 padding">
<div class="solMod shadow">
<h6>Solicitação de Moderação - 3875</h6>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4 padding">
<div class="solCad shadow">
<h6>Solicitações de Cadastro - 1254</h6>
</div>
</div>
<div class="col-md-8 padding">
<div class="solCadExpand shadow">
<h6>Solicitações de Cadastro - 1254</h6>
<!-- Charts -->
</div>
</div>
</div>
However at the time does not display the graph. I tested in simple html and it worked. But at angular no..
How did you add the Canvasjs library to your project? Did you add it in angular-cli.json? gives a look here: https://github.com/angular-cli/wiki/stories-global-scripts
– Eduardo Vargas