0👍
I’m not sure I completely understand what your question / issue is, but I’ll give it a shot.
This code from your segment segment:
this.economicData = result;
console.log(this.economicData);
this.value = this.economicData.observations // other code here
Based on your console log screenshot this.economicData
is an array. But, then you try to access a property on it, which I would expect to give an error.
- Chartjs-I would like to show a line bar in chart.js with data automatically fetched from mockapi
- Chartjs-Chart.js piechart, only have border on the outside of arc
0👍
Just look at my example. you have to install newtonsoft nuget package in order this code work.
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("API URL");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var inputs = new Parameters() { inputs }; // parameters is a class of your api input parameters
HttpResponseMessage response = await client.PostAsJsonAsync("Continuation of your API URL", inputs);
var resultString = await response.Content.ReadAsStringAsync();
Excel resultJson = JsonConvert.DeserializeObject<your API Output Class>(resultString)!;
if (response.IsSuccessStatusCode)
{
// your code after api response receive.
}
else
{
Console.WriteLine("Error");
}
}
if this helped someone, pls upvote and accept this answer. thank you
Source:stackexchange.com