Angular2-highcharts with observables in Angular 4 project
See original GitHub issueI am trying to create a chart working with observables coming from http request, the following code is working with some fake datas I just would like to replace them by true datas coming from a backend-end script here’s my code:
my app.ts:
`export class MyVerticalchartComponent {
@Input() showMePartially: boolean;
options: Object;
constructor(public userService3: UserService3) {
this.options = {
title : { text : '' },
chart: { type: 'area' },
legend: { enabled: false },
credits: { enabled: false },
xAxis: { type: 'datetime',
// startOnTick: true,
// endOnTick: true,
// tickInterval: 24 * 3600 * 1000,
},
dateTimeLabelFormats: {
second: '%H:%M:%S',
minute: '%H:%M:%S',
hour: '%H:%M:%S',
day: '%H:%M:%S',
week: '%H:%M:%S',
month: '%H:%M:%S',
year: '%H:%M:%S'
},
yAxis: { min: 0,
max: 100 },
plotOptions: {
series: {
// pointStart: 0,
color: '#648e59',
fillOpacity: 0.8,
fillColor: '#648e59'
}
},
series: [{
name: 'Someone1',
data: [
[1497837618,0],[1497837738,0],[1497837858,0],[1497837978,0],[1497838098,0],[1497838218,0],[1497838338,0],[1497838458,0] ],
}]
};
}
}`
my app.html:
`<chart [options]="options">
<series>
</series>
</chart>`
my http service.ts:
` export interface User3 {
data: any;
}
const usersURL = 'http://my.super.backend.script.com';`
@Injectable() export class UserService3 { users3: Observable<User3[]>; constructor (public http: Http) { const tick3$ = Observable.timer(100, 60000); this.users3 = tick3$.flatMap(() => http.get(usersURL)).map(res => [res.json()]).publishBehavior(<User3[]>[]).refCount(); } }
my json looks like:
` "operating_details":[[1497837618,0],[1497837738,0],[1497837858,0],
[1497837978,0],[1497838098,0],[1497838218,0],[1497838338,0],
[1497838458,0],[1497838578,0],[1497838698,0],[1497838818,0],
[1497838938,0],[1497839058,0],[1497839178,0],[1497839298,0],
[1497839418,0],[1497839538,0],[1497839658,0],[1497839778,0]]`
Issue Analytics
- State:
- Created 6 years ago
- Comments:15
Top Results From Across the Web
Angular2-highcharts with observables in Angular 4 project
exactly my friend.. in my console.log() I get my object but I can't render it in my chart..looks like a path issue.. –...
Read more >Angular2Highcharts with Observables In Angular 4 Project - ADocLib
I'm having difficulty handrolling a solution involving adding a click listener to an XAxis label specifically a column chart from the HighCharts API....
Read more >Highcharts with Angular V14
Learn how to create an interactive chart with Highcharts and Angular 14 via node.
Read more >angular-highcharts
Start using angular-highcharts in your project by running `npm i ... This is a directive for an easy usage of Highcharts with angular....
Read more >angular2-Highcharts not working in angular-cli project- ...
I had the same problem. I didn't have much time to resolve the problem. So i used ng2-highchart (an alternative for angular2-highcharts). -you...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@PascalTemel you right you right
@Papamilo i fixed your syntax highlighting take a look at this https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code