You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tired to implement Blazor extension version based on ChartJs.Blazor, However, I found that I cannot add additional ChartTypes. I used reflection to create valid objects.
public static class ChartTypeFactory
{
public static ChartTypes CreateCandlestick() =>
Construct<ChartTypes>(
new Type[] { typeof(string) },
new object[] { "candlestick" }
);
public static ChartTypes CreateOhlc() =>
Construct<ChartTypes>(
new Type[] { typeof(string) },
new object[] { "ohlc" }
);
public static T Construct<T>(Type[] paramTypes, object[] paramValues)
{
Type t = typeof(T);
ConstructorInfo ci = t.GetConstructor(
BindingFlags.Instance | BindingFlags.NonPublic,
null, paramTypes, null);
return (T)ci.Invoke(paramValues);
}
}
We should add a ChartType.Custom(string chartType) method to the ChartType-'enum' with a summary along the lines of
This method constructs a <see cref="ChartType" /> which represents the given value. Only use this method if you're implementing your own chart e.g. for a chart.js extension, otherwise use the given values.
I'm adding this to the backlog so it can be added in a feature release.
I found a great extension for chartJS which allows to create candlestick chart. https://github.com/chartjs/chartjs-chart-financial
I tired to implement Blazor extension version based on ChartJs.Blazor, However, I found that I cannot add additional ChartTypes. I used reflection to create valid objects.
The sample project with candlestick chart can be access via link https://github.com/oleksiizapara/ChartJsBlazorFinancialSample
I hope that in future release the library will be able to do it straightforward.
May be it can be done via base class that can be inherited?
The text was updated successfully, but these errors were encountered: