Heartbeat1
✅ Done! Chartjs has one wrong entry and i dont know why
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>
7 replies