DashRender 1.0.0

dotnet add package DashRender --version 1.0.0
                    
NuGet\Install-Package DashRender -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DashRender" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DashRender" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="DashRender" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DashRender --version 1.0.0
                    
#r "nuget: DashRender, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DashRender@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DashRender&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=DashRender&version=1.0.0
                    
Install as a Cake Tool

📊 DashRender

DashRender é uma biblioteca .NET que permite gerar dashboards gráficos como imagens (PNG) ou Base64 utilizando o SkiaSharp. Ideal para cenários onde você precisa embutir gráficos em e-mails, relatórios PDF, APIs ou aplicações web.

Criado para gerar dashboards simples e rápidos, sem necessidade de ferramentas externas de BI.


📦 Instalação via NuGet

dotnet add package DashRender

Ou via Visual Studio:

Gerenciador de Pacotes NuGet > Procurar > DashRender

✅ Como Funciona

Você precisa montar um objeto de entrada do tipo DashboardDefinition, que representa o seu dashboard.

Estrutura de DashboardDefinition

Propriedade Tipo Descrição
Title string Título principal do dashboard
Subtitle string Subtítulo (ex: período ou região)
Charts List<ChartDefinition> Lista de gráficos
Colors SKColor[] (Opcional) Paleta de cores personalizada para os gráficos

Detalhes sobre as cores (Colors)

  • Se você não informar o array Colors, a biblioteca automaticamente irá gerar uma sequência de cores randômicas a partir de uma paleta completa de cores baseadas no padrão SkiaSharp.SKColors.

📋 Exemplos de Cores Disponíveis

  • Red
  • Blue
  • Green
  • Orange
  • Yellow
  • Purple
  • Cyan
  • Magenta
  • DarkGreen
  • Gold
  • RoyalBlue
  • ... (veja todas as demais cores disponíveis no namespace SkiaSharp.SKColors)

📂 Exportando para Imagem

Se quiser gerar a imagem, informe o caminho de saída.

Exemplo de Uso:

DashboardImageRenderer.ExportDashboardImageToFile(dashboard, @"C:\Relatorios\dashboard-vendas.png");

Exemplo de Resultado:

dashboard_grid


🖼️ Exportando como Base64

Se quiser gerar como Base64 (útil para envio via API ou embutir em HTML):

string base64Image = DashboardImageRenderer.ExportDashboardImageAsBase64(dashboard);

🛠️ Exemplo Completo de Uso

using DashRender;
using SkiaSharp;

var dashboard = new DashboardDefinition
{
    Title = "Dashboard de Performance Comercial",
    Subtitle = "Resultados Consolidados - 1º Semestre 2025",
    Colors = new SKColor[]
    {
        SKColors.Red,
        SKColors.Green,
        SKColors.Blue,
        SKColors.Orange
    },
    Charts =
    [
        new()
        {
            Title = "Vendas por Filial (R$)",
            ChartType = ChartType.Pie,
            DisplayLegend = true,
            DataPoints =
            [
                new() { Label = "São Paulo", Value = 35200.75m, Unit = "R$" },
                new() { Label = "Rio de Janeiro", Value = 27450.30m, Unit = "R$" },
                new() { Label = "Bahia", Value = 19870.00m, Unit = "R$" },
                new() { Label = "Minas Gerais", Value = 15800.90m, Unit = "R$" }
            ]
        },
        new()
        {
            Title = "Crescimento Mensal de Vendas (R$)",
            ChartType = ChartType.VerticalBar,
            DisplayLegend = true,
            DataPoints =
            [
                new() { Label = "Janeiro", Value = 12000m, Unit = "R$" },
                new() { Label = "Fevereiro", Value = 14500m, Unit = "R$" },
                new() { Label = "Março", Value = 13200m, Unit = "R$" },
                new() { Label = "Abril", Value = 16000m, Unit = "R$" },
                new() { Label = "Maio", Value = 17050m, Unit = "R$" },
                new() { Label = "Junho", Value = 18900m, Unit = "R$" }
            ]
        }
    ]
};

// Exporta como arquivo
DashboardImageRenderer.ExportDashboardImageToFile(dashboard, @"C:\Relatorios\dashboard-performance.png");

// Ou exporta como Base64
string base64 = DashboardImageRenderer.ExportDashboardImageAsBase64(dashboard);

🎨 Tipos de Gráfico Suportados (ChartType)

  • Pie → Gráfico de Pizza
  • VerticalBar → Barras Verticais
  • HorizontalBar → Barras Horizontais

📌 Requisitos

  • .NET 6.0 ou superior
  • SkiaSharp (adicionado automaticamente via NuGet)

🤝 Contribuições

Pull Requests, melhorias de design ou novos tipos de gráfico são super bem-vindos!

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 229 6/19/2025