JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Charts & Data Viz › Create a Band on Blazor.Chart
- This topic has 4 replies, 2 voices, and was last updated 1 year ago by svetoslav_borislavov.
-
AuthorPosts
-
October 12, 2023 at 9:03 pm #108966salasidisParticipant
I am trying to create a band on eth value axis, but can’t seem to get a combination that works
This is what I have, and I am getting errors
List<ChartSeriesGroup> seriesGroups = new List<ChartSeriesGroup>(){
new ChartSeriesGroup()
{Type = ChartType.Line,
ValueAxis = new ChartValueAxis()
{
//UnitInterval = 10,
//MinValue = 0,
//MaxValue = 100,AxisSize = “auto”,
Description = “Val”
},Bands = new List<ChartValueAxisBand>()
{
new ChartValueAxisBand()
{
Opacity = 0.05,
MinValue = 10,
MaxValue = 20
}
},
Series = new List<ChartSeriesGroupSerie>()
{
new ChartSeriesGroupSerie()
{
DataField = “”,
DisplayText = “”,}
}
}October 13, 2023 at 8:11 am #108971svetoslav_borislavovParticipantHi,
Here is an example of using colour bands in Blazor:
https://www.htmlelements.com/blazor/blazor-ui/demos/blazor-chart?id=color-bandsI can see that you haven’t set DataField for your ChartSeriesGroupSerie also.
Best Regards,
Svetoslav BorislavovSmart UI Team
https://www.htmlelements.com/October 13, 2023 at 12:59 pm #108972salasidisParticipantThe example did not have any bands in it, is it possible to repost. Thanks
I programmatically set the DisplayField and TextField elsewhere, and tried to set the Band values there as well (but the latter part did not work – likely because the actual elements were not properly created by me)
chart is defined as
<Chart @ref=”lineChart” DataSource=”chartData” Animation=”Animation.None” Caption=”” Description=””
ShowLegend=”false” ShowBorderLine=”false” Padding=”new Padding() { Left = 5, Top = 15, Right = 25, Bottom = 5 }”
XAxis=”xAxis” SeriesGroups=”seriesGroups” ColorScheme=”ChartColorScheme.Scheme01″ OnReady=”OnChartReady” @key=”updateChart” showToolTips=”true” />some elements are altered
chartData = EWparData;
seriesGroups.ElementAt(0).Series.ElementAt(0).DataField = “Result”;
seriesGroups.ElementAt(0).Series.ElementAt(0).DisplayText = par;seriesGroups.ElementAt(0).ValueAxis.Description = par;
seriesGroups.ElementAt(0).ValueAxis.Bands.ElementAt(0).Opacity = (float)0.05;
seriesGroups.ElementAt(0).ValueAxis.Bands.ElementAt(0).MinValue = (float)minN;
seriesGroups.ElementAt(0).ValueAxis.Bands.ElementAt(0).MaxValue = (float)maxN;dispChart = true;
October 13, 2023 at 4:37 pm #108973salasidisParticipantI changed the Bands definition to ChartSeriesGroupBand (instead of ChartValueAxisBand)
Bands = new List<ChartSeriesGroupBand>()
{
new ChartSeriesGroupBand()
{
Opacity = (float)0.05,
MinValue = 10,
MaxValue = 20
}
},The setting of the data is
seriesGroups.ElementAt(0).Bands.ElementAt(0).Opacity = (float)0.05;
seriesGroups.ElementAt(0).Bands.ElementAt(0).MinValue = (float)minN;
seriesGroups.ElementAt(0).Bands.ElementAt(0).MaxValue = (float)maxN;This compiles successfully, but I get no visible bands
October 18, 2023 at 5:45 am #109008svetoslav_borislavovParticipantHi,
May you navigate to demos from the link I have sent you and then select the demo ‘Color Bands’
You can see that there are color bands, try to implement them as in the demo.Best Regards,
Svetoslav BorislavovSmart UI Team
https://www.htmlelements.com/ -
AuthorPosts
- You must be logged in to reply to this topic.