This commit is contained in:
Дмитрий Блохин 2024-05-30 03:32:08 +04:00
commit 5a399a9e20
3 changed files with 7 additions and 9 deletions

View File

@ -3,7 +3,7 @@
} }
<div class="text-center"> <div class="text-center">
<h1 class="display-4">Главное меню</h1> <h1 class="display-4">Меню графиков</h1>
<div class="list-group"> <div class="list-group">
<a class="nav-link text-dark" asp-area="" asp-controller="Chart" asp-action="ProductHistogramm">Изделия</a> <a class="nav-link text-dark" asp-area="" asp-controller="Chart" asp-action="ProductHistogramm">Изделия</a>
<a class="nav-link text-dark" asp-area="" asp-controller="Chart" asp-action="ProductionHistogramm">Производства</a> <a class="nav-link text-dark" asp-area="" asp-controller="Chart" asp-action="ProductionHistogramm">Производства</a>

View File

@ -4,19 +4,18 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Histogram Example</title>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</head> </head>
<body> <body>
<div> <div>
<canvas id="myChart" width="400" height="150"></canvas> <canvas id="Hist" width="400" height="150"></canvas>
</div> </div>
<script> <script>
var ctx = document.getElementById('myChart').getContext('2d'); var ctx = document.getElementById('Hist').getContext('2d');
var data = { var data = {
labels: @Html.Raw(Json.Serialize(Model.Select(m => m.DetailName))), labels: @Html.Raw(Json.Serialize(Model.Select(m => m.DetailName))),
datasets: [{ datasets: [{
label: 'Category Data', label: 'Количество деталей в изделиях',
data: @Html.Raw(Json.Serialize(Model.Select(m => m.ProductCount))), data: @Html.Raw(Json.Serialize(Model.Select(m => m.ProductCount))),
backgroundColor: 'rgba(75, 192, 192, 0.2)', backgroundColor: 'rgba(75, 192, 192, 0.2)',
borderColor: 'rgba(75, 192, 192, 1)', borderColor: 'rgba(75, 192, 192, 1)',

View File

@ -4,19 +4,18 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>Histogram Example</title>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</head> </head>
<body> <body>
<div> <div>
<canvas id="myChart" width="400" height="150"></canvas> <canvas id="Chart" width="400" height="150"></canvas>
</div> </div>
<script> <script>
var ctx = document.getElementById('myChart').getContext('2d'); var ctx = document.getElementById('Chart').getContext('2d');
var data = { var data = {
labels: @Html.Raw(Json.Serialize(Model.Select(m => m.DetailName))), labels: @Html.Raw(Json.Serialize(Model.Select(m => m.DetailName))),
datasets: [{ datasets: [{
label: 'Category Data', label: 'Количество производств к деталям',
data: @Html.Raw(Json.Serialize(Model.Select(m => m.ProductionCount))), data: @Html.Raw(Json.Serialize(Model.Select(m => m.ProductionCount))),
backgroundColor: 'rgba(75, 192, 192, 0.2)', backgroundColor: 'rgba(75, 192, 192, 0.2)',
borderColor: 'rgba(75, 192, 192, 1)', borderColor: 'rgba(75, 192, 192, 1)',