I'm using the AMCharts control and I'm trying to follow the example however, I'm not sure how I get the data out of my historyItemCollection (fig 1) into an Observable collection (fig 2)?
Fig 1:
from item in App.ViewModel.historyItemCollection
where item.VehicleId == (Application.Current as App).vehicleId
select item;
Fig 2:
private ObservableCollection<TestDataItem> _data = new ObservableCollection<TestDataItem>()
{
new TestDataItem() { axis = "Mar", value=5},
new TestDataItem() { axis = "Apr", value=15.2},
new TestDataItem() { axis = "May", value=25},
new TestDataItem() { axis = "June", value=8.1},
};
In the historyitemcollection I have a date item that I would put in the axis value as well as a cost item that I would put in the value value (fig 2:)
How can I get my data into the observableCollection so I can use this chart control?
_data = new ObservableCollection<HistoryItem>
(
from item in App.ViewModel.historyItemCollection
where item.VehicleId == (Application.Current as App).vehicleId
select item;
)
or if at runtime
var historyItems =
from item in App.ViewModel.historyItemCollection
where item.VehicleId == (Application.Current as App).vehicleId
select item;
foreach (var item in historyItems)
_data.Add(item);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.