i want to binde api data so it can render highchart according to data in angular 2 and typescript. - export class DashboardComponent implements OnInit {
- //api having some data
- phones = this.http.get('http://localhost:7788/countphones').map(res => res.json())
-
laptops = this.http.get('http://localhost:7788/countlaptops').map(res => res.json())
-
televisions = this.http.get('http://localhost:7788/counttelevisions').map(res => res.json())
-
constructor(private http:Http) { }
-
-
ngOnInit() {
-
Observable
-
.forkJoin(this.phones, this.laptops, this.televisions)
-
.subscribe(([phones, laptops, televisions])=>{
-
this.phones = phones; //some data
-
this.laptops = laptops; //some data
-
this.televisions = televisions; //some data
-
-
});
-
}
-
chart = new Chart({
-
chart: {type: 'bar'},
-
title: {text: 'Product Charts'},
-
xAxis :{
-
categories: ['Televisions', 'phones', 'Laptops'],
-
title: { text: 'Product Names',},
-
},
-
yAxis : {
-
title: {text: 'Product (Quantity)',},
-
},
-
credits: {enabled: false},
-
series: [{
-
name: 'Line 1',
-
data: [['TELEVISIONS',//bind here api data], ['PHONES',//bind here api data ], ['LAPTOPS',//bind data here ]]
-
}]
-
});
more explanation in image
0 1449 Sign in to post your reply or Sign up for a free account.
Similar topics
by: Vijaya |
last post by:
Can we bind data to textbox in a headertemplate in a
template column of a datagrid?
If so please give some code snippets.
Thank you
|
by: Kobe |
last post by:
I am trying to bind data in a collection to a combo box in a windows
application. I am able to retrieve records from the collection but when I
bind it to the combo box, nothing is displayed
...
|
by: Santosh |
last post by:
Dear all i want to bind data to datagrid header template i am wrtting
follwing code it is displaying data with in item template not but it is
display data in header template
<asp:DataGrid...
|
by: vineetbatta |
last post by:
I have Custom Data class which stores data about single customer and then i
store that customer objects in arraylist as shown below.
Customer custdata = null; // Custom Data class for 1 customer...
|
by: chandana Devabhaktuni |
last post by:
Hello and Hi to everyone,
This is chandana, i have a doubt which i am mentioning here.
We can retrive or bind data to datagrid from database(sql server) and also we can...
|
by: Ahmed Osama |
last post by:
I'm using NetBeans 5.5
First :I want to bind data from table from MS Access DB into JTable .
Second: Is there any other component in java to do the previous action(e.g. DataGrid )
|
by: sudhashekhar30 |
last post by:
i have dropdownlist with data. based on selected item(dropdownlist) i am retrieving data(single value) from database(sql server) using sqldataadapter and wanted to show this value in textbox. I want...
|
by: newtodotnet1 |
last post by:
Hi all,
I would like to know how to bind data to the gridview using XPath.. The data is in the XML format..
Please help me....
Its urgent..
I am using asp.net and c#.net
|
by: jaredciagar |
last post by:
Hi guys...can you help me please....
I'm using ASP.net, MSSQL 2005 and VB Script
I have don't know how to bind data in gridview control from database.
I want also to allow paging in gridview...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |