This is a migrated thread and some comments may be shown as answers.

Stock Charts / Stock History

1 Answer 93 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Boštjan
Top achievements
Rank 1
Boštjan asked on 08 Jan 2016, 10:37 PM

"Stock Charts / Stock History" ( http://demos.telerik.com/kendo-ui/financial/stock-history )

In the following example $("#company-filtering-tabs").kendoTabStrip was populated by local array (dataSource: ["Google", "Apple", "Amazon"]). I wonder how can I populate it from stocksDataSource and it's distinct field symbol. 

stocksDataSource is retrieve from: http://demos.telerik.com/kendo-ui/content/dataviz/dashboards/stock-data-2011.json

and it's structure goes like:

[ { "date": "3/31/2011", "close": 586.76, "volume": 2028228, "open": 583, "high": 588.1612, "low": 581.74, "symbol": "1. GOOG" },

  { "date": "3/31/2011", "close": 586.76, "volume": 2028228, "open": 583, "high": 588.1612, "low": 581.74, "symbol": "1. GOOG" }, ....

  { "date": "3/31/2011", "close": 405, "volume": 6414369, "open": 403.51, "high": 406.28, "low": 403.49, "symbol": "2. AAPL" }, ....

  { "date": "13/31/2011", "close": 382.2, "volume": 14464710, "open": 381.29, "high": 382.276, "low": 378.3, "symbol": "3. AMZN" }, ....

]

Thank you for your answers!

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 13 Jan 2016, 10:02 AM
Hi,

Please accept my apologies for the delayed response.

The problem boils down to extracting the unique values for the symbol field in the data array.
There are obviously many approaches to this problem. For example, if using loadsh we can do:
    var symbols = _.uniqBy(data, 'symbol');

The best moment to do that would be in the data source change event where all the data is available.

Regards,
T. Tsonev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Charts
Asked by
Boštjan
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or