I have an existing project in which I want to implement zingcharts.
I tried 3 different tutorials mainly from " https://blog.zingchart.com/2016/07/19/zingchart-and-angular-2-charts-back-at-it-again/ ".
However, I cannot get this to work in my project. So I decided that first I would try to implement it in the easiest way, and then try better. This is what I did, but he is not buying yet.
Being new to angular2, I'm not quite sure if this will work.
I went to the ZingChart website and tried to implement this basic example -> https://www.zingchart.com/docs/getting-started/your-first-chart/
So, I created 2 chart.ts and chart.component.html files and implemented
"<script src="https://cdn.zingchart.com/zingchart.min.js"></script>"
in index.html
//chart.ts
import { Component } from '@angular/core';
@Component({
selector: 'rt-chart',
templateUrl: './chart.component.html'
})
export class Chart
{
}
//chart.component.html
<div id="chartDiv"></div>
<script>
var chartData = {
type: "bar",
title: {
text: "My First Chart"
},
legend: {},
series: [
{ values: [35, 42, 67, 89]},
{ values: [28, 40, 39, 36]}
]
};
zingchart.render({
id: "chartDiv",
data: chartData,
height: 400,
width: 600
});
</script>
-
. ? -, .
Angular2 .