C
C#3y ago
Heartbeat1

✅ Done! Chartjs has one wrong entry and i dont know why

In the Picture are shown the entry from the value and the chart(both in green). setting the decimal list foreach (var data in Model.market_average_History) { averagesell[i] = data.averagesellPrice; averagebuy[i] = data.averagebuyPrice; ActDate[i] = data.Actdate; maxsell[i] = data.maxsellPrice; maxbuy[i] = data.maxbuyPrice; minsell[i] = data.minsellPrice; minbuy[i] = data.minbuyPrice; i = i + 1; }
4 Replies
Heartbeat1
Heartbeat1OP3y ago
Creating the data for the chart <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <script> const labels = @Html.Raw(Json.Serialize(ActDate)); const data = { labels: labels, datasets: [{ label: 'Average Sell', backgroundColor: 'rgb(255, 99, 132)', borderColor: 'rgb(255, 99, 132)', data: @Html.Raw(Json.Serialize(averagesell)), yAxisID: 'y', }, { label: 'Average Buy', backgroundColor: 'rgb(0, 99, 132)', borderColor: 'rgb(0, 99, 132)', data: @Html.Raw(Json.Serialize(averagebuy)), yAxisID: 'y', }, { label: 'Max Buy Price', backgroundColor: 'rgb(0, 0, 132)', borderColor: 'rgb(0, 0, 132)', data: @Html.Raw(Json.Serialize(maxbuy)), yAxisID: 'y', }, { label: 'Max Sell Price', backgroundColor: 'rgb(0, 255, 132)', borderColor: 'rgb(0, 255, 132)', data: @Html.Raw(Json.Serialize(maxsell)), yAxisID: 'y', }, { label: 'Min Buy Price', backgroundColor: 'rgb(0, 255, 255)', borderColor: 'rgb(0, 255, 255)', data: @Html.Raw(Json.Serialize(minbuy)), yAxisID: 'y', }, { label: 'Min Sell Price', backgroundColor: 'rgb(255, 0, 255)', borderColor: 'rgb(255, 0, 255)', data: @Html.Raw(Json.Serialize(minsell)), yAxisID: 'y', }] }; data.datasets[0].data[1] = "200000"; const config = { type: 'line', data: data, options: {} }; </script> <div style="width:80%"> <canvas id="myChart"></canvas> </div> <script> const myChart = new Chart( document.getElementById('myChart'), config ); </script> Does someone have an idea why? Its also not on each item but with an few of them.
Saber
Saber3y ago
data.datasets[0].data[1] = "200000"; i wonder what that is doing
Heartbeat1
Heartbeat1OP3y ago
thanks dumb from me
Accord
Accord2y ago
Want results from more Discord servers?
Add your server