Blazor.FamilyChart 0.0.0

dotnet add package Blazor.FamilyChart --version 0.0.0
                    
NuGet\Install-Package Blazor.FamilyChart -Version 0.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="Blazor.FamilyChart" Version="0.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Blazor.FamilyChart" Version="0.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Blazor.FamilyChart" />
                    
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 Blazor.FamilyChart --version 0.0.0
                    
#r "nuget: Blazor.FamilyChart, 0.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 Blazor.FamilyChart@0.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=Blazor.FamilyChart&version=0.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Blazor.FamilyChart&version=0.0.0
                    
Install as a Cake Tool

Blazor Family Chart

This is a wrapper library for family-chart and it is only compatible with Blazor WASM.

Current family-chart version packaged in this library: 0.9.0.

Installation

Usage

First register Blazor.FamilyChart dependencies:

builder.Services.AddFamilyChart();

This library depends on the library Blazor.Core in which provides the feature to help serialize/deserialize C# callback to Javascript. To ensure Blazor.FamilyChart work correctly, you must call RegisterCallbackReviverAsync() from the Blazor.Core library.

var webHost = builder.Build();

await webHost.RegisterCallbackReviverAsync();
await webHost.RunAsync();

Now you can use FamilyChartComponent like this

<FamilyChartComponent
  ChartId="my-family"
  PostFirstRender="@ConfigureAsync"
  InitialData="@([new()
  {
    Id = "john",
    Data = new()
    {
      Gender = Gender.Male,
      Extensions = new Dictionary<string, object?> { ["firstName"] = "John", ["lastName"] = "Smith" }
    },
    Relationships = new(),
  }])"
  Style="width:100%;height:500px;margin:auto;background-color:rgb(33,33,33);color:#fff;"/>

@code {
  private async Task ConfigureAsync(FamilyChartComponent component)
  {
    await component.Chart.SetTransitionTimeAsync(1000);
    await component.Chart.SetSingleParentEmptyCardAsync(true, new() { Label = "ADD"} );
    await component.Chart.SetShowSiblingsOfMainAsync(true);
    await component.Chart.SetOrientationVerticalAsync();
    
    await component.CardHtml.SetCardDisplayAsync(["firstName", "lastName"]);
    await component.CardHtml.SetMiniTreeAsync(true);
    await component.CardHtml.SetCardDimAsync(null);
    await component.CardHtml.SetStyleAsync(Blazor.FamilyChart.Models.CardHtml.CardHtmlStyle.ImageCircleRect);
    await component.CardHtml.SetOnHoverPathToMainAsync();

    await component.EditTree.FixedAsync();
    await component.EditTree.SetFieldsAsync(["firstName", "lastName"]);
    await component.EditTree.SetEditFirstAsync(true);
    await component.EditTree.SetCardClickOpenAsync();

    await component.Chart.UpdateTreeAsync(new() { Initial = true });
  }
}

Serialize/deserialize derived types

If you have classes that inhereit from classes in this library, then you need to use the following extension method, UseTypeInfoResolver. This allows serializing your derived classes with all of their properties.

This method accepts a type resolver and this library includes PolymorphicTypeResolver out of the box so that you can get started quickly.

var webHost = builder
  .Build()
  .UseTypeInfoResolver<PolymorphicTypeResolver>(typeInfoResolver =>
  {
    typeInfoResolver.AddDerivedTypes<BaseClass>(typeof(DeriveClass));
  });

await webHost.RegisterCallbackReviverAsync();
await webHost.RunAsync();

Design

This library aims to expose the methods and functionality in family-chart as much as possible. Thus all methods and classes mirror with what is defined in family-chart.

The followings classes are what you would use to interact and configure your family chart.

The methods in these classes mirror with the methods defined in the TS library. If there is a difference, it will be noted in the XML comment.

Extensions

There can be functionalities that aren't possible to do in Blazor (perhaps due to my lack of experience) or not implemented yet in the original family-chart. So in those cases, this library will define its own extension to satisfy those cases.

Those extensions will be defined in FamilyChartComponent so that it is separated from the "core" classes (mentioned above). Those core classes are meant to be 1-1 with the family-chart library. Thus anything that is custom, extra, etc... will be defined somewhere else like in FamilyChartComponent.

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
0.0.0 249 12/6/2025