GoogleCharts.NET.Wrapper
2.0.0
dotnet add package GoogleCharts.NET.Wrapper --version 2.0.0
NuGet\Install-Package GoogleCharts.NET.Wrapper -Version 2.0.0
<PackageReference Include="GoogleCharts.NET.Wrapper" Version="2.0.0" />
paket add GoogleCharts.NET.Wrapper --version 2.0.0
#r "nuget: GoogleCharts.NET.Wrapper, 2.0.0"
// Install GoogleCharts.NET.Wrapper as a Cake Addin
#addin nuget:?package=GoogleCharts.NET.Wrapper&version=2.0.0
// Install GoogleCharts.NET.Wrapper as a Cake Tool
#tool nuget:?package=GoogleCharts.NET.Wrapper&version=2.0.0
GoogleCharts.NET.Wrapper 2.0.0
Available charts :
- Timeline
- Gantt
- Columns
How to start :
1. Add scripts to head of index.html:
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript" src="/_content/GoogleCharts.NET.Wrapper/js/GoogleChartsWrapper.js"></script>
2. Add imports to _Imports.razor file
@using GoogleCharts.NET.Wrapper
@using GoogleCharts.NET.Wrapper.DataModels
@using GoogleCharts.NET.Wrapper.DataModels.Timeline
@using GoogleCharts.NET.Wrapper.DataModels.Gantt
@using GoogleCharts.NET.Wrapper.DataModels.Column
@using GoogleCharts.NET.Wrapper.Components
How to use:
@if (@Gantt != null)
{
<GoogleChart DataTable="@Gantt"></GoogleChart>
}
@code {
public DataTable<DataTableGanttRow> Gantt { get; set; }
protected override async Task OnInitializedAsync()
{
//create Instance of DataTable with provided ID
Gantt = await DataTable<DataTableGanttRow>.CreateAsync(jsRuntime, "myid");
//add specific options to current chart
await Gantt.AddOptions(new GanttOptions
{
Height = 300,
Gantt = new Gantt
{
TrackHeight = 50,
BarHeight = 48
}
}
);
//add data to chart
Gantt.AddRow(new DataTableGanttRow
{
TaskId = "2014Spring",
TaskName = "Spring 2014",
Resource = "spring",
StartDate = new DateTime(2014, 2, 22),
EndDate = new DateTime(2014, 5, 20),
Duration = null,
PercentComplete = 100,
Dependencies = null
});
Gantt.AddRow(new DataTableGanttRow
{
TaskId = "2014Summer",
TaskName = "Summer 2014",
Resource = "summer",
StartDate = new DateTime(2014, 5, 21),
EndDate = new DateTime(2014, 8, 20),
Duration = null,
PercentComplete = 100,
Dependencies = null
});
Gantt.AddRow(new DataTableGanttRow
{
TaskId = "2015Summer",
TaskName = "Summer 2015",
Resource = "summer",
StartDate = new DateTime(2015, 5, 21),
EndDate = new DateTime(2015, 8, 20),
Duration = null,
PercentComplete = 100,
Dependencies = null
});
Gantt.AddRow(new DataTableGanttRow
{
TaskId = "2014Autumn",
TaskName = "Autumn 2014",
Resource = "autumn",
StartDate = new DateTime(2014, 8, 21),
EndDate = new DateTime(2014, 11, 20),
Duration = null,
PercentComplete = 100,
Dependencies = null
});
//set call back function which will be called when you click on a chart
await Gantt.SetCallbackFunctionName(DotNetObjectReference.Create(this), "ShowAlert", true);
//draw the chart
await Gantt.DrawChart();
}
[JSInvokable]
public void ShowAlert()
{
Console.WriteLine("HOORAY");
}
}
You can see more examples here
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net6.0
- Microsoft.AspNetCore.Components.Web (>= 6.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Breaking changes:
1. Instance of DataTable now is created via DataTable.CreateAsync method.
2. SetChartId is deleted. (id now must be provided to CreateAsync method)
3. GanttChart, TimelineChart components are replaced with GoogleChart component.
New features:
1. .NET 6 compatible.
2. Added Columns chart.
3. Added GanttOptions, TimelineOptions and ColumnsOptions
4. Now supports multiple charts of same type.