@page "/quotes/dashboard"
@using PSC.Blazor.Components.Chartjs
@using PSC.Blazor.Components.Chartjs.Models.Pie
@using PSC.Blazor.Components.Chartjs.Models.Bar
@using PSC.Blazor.Components.Chartjs.Models.Line
@using PSC.Blazor.Components.Chartjs.Models.Common
@inject NavigationManager Navigation
Dashboard Operativo de Presupuestos
Top Productos Presupuestados
@code {
private PieChartConfig _pieChartConfig;
private BarChartConfig _barChartConfig;
private LineChartConfig _lineChartConfig;
protected override void OnInitialized()
{
InitPieChart();
InitBarChart();
InitLineChart();
}
private void InitPieChart()
{
_pieChartConfig = new PieChartConfig
{
Options = new PieOptions
{
Plugins = new Plugins
{
Legend = new Legend
{
Display = true,
Position = LegendPosition.Bottom
}
}
},
Data = new PieData
{
Labels = new List { "Aprobado", "Pendiente", "Rechazado" },
Datasets = new List
{
new PieDataset
{
Data = new List { 60, 25, 15 },
BackgroundColor = new List { "#4CAF50", "#FFC107", "#F44336" }
}
}
}
};
}
private void InitBarChart()
{
_barChartConfig = new BarChartConfig
{
Options = new Options
{
Plugins = new Plugins { Legend = new Legend { Display = false } },
Scales = new Dictionary
{
["x"] = new Axis { Title = new AxesTitle { Display = true, Text = "Producto" } },
["y"] = new Axis { Title = new AxesTitle { Display = true, Text = "Cantidad" } }
}
},
Data = new BarData
{
Labels = new List { "Prod A", "Prod B", "Prod C", "Prod D", "Prod E" },
Datasets = new List
{
new BarDataset
{
Data = new List { 10, 8, 6, 5, 4 },
BackgroundColor = Enumerable.Repeat("#2196F3", 5).ToList()
}
}
}
};
}
private void InitLineChart()
{
_lineChartConfig = new LineChartConfig
{
Options = new Options
{
Plugins = new Plugins { Legend = new Legend { Display = true } },
Scales = new Dictionary
{
["x"] = new Axis { Title = new AxesTitle { Display = true, Text = "Mes" } },
["y"] = new Axis { Title = new AxesTitle { Display = true, Text = "Monto ($)" } }
}
},
Data = new LineData
{
Labels = new List { "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio" },
Datasets = new List
{
new LineDataset
{
Label = "Total Presupuestado",
Data = new List { 10000, 12000, 13000, 14000, 16000, 20000 },
Fill = false,
BorderColor = "#4CAF50",
Tension = 0.3m
}
}
}
};
}
}