Skip to content

Commit ba59bbf

Browse files
committed
Chartdataset is now set to double? to allow for gaps in the data (to start later in the x-axis, for example)
1 parent 2f7df44 commit ba59bbf

19 files changed

+130
-49
lines changed

BlazorBootstrap.Demo.RCL/Components/Pages/Charts/BarCharts/BarChart_Demo_01_Examples.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
{
4848
var count = barChartDataset.Data.Count;
4949

50-
var newData = new List<double>();
50+
var newData = new List<double?>();
5151
for (var i = 0; i < count; i++)
5252
{
5353
newData.Add(random.Next(200));
@@ -134,9 +134,9 @@
134134
};
135135
}
136136

137-
private List<double> GetRandomData()
137+
private List<double?> GetRandomData()
138138
{
139-
var data = new List<double>();
139+
var data = new List<double?>();
140140
for (var index = 0; index < labelsCount; index++)
141141
{
142142
data.Add(random.Next(200));

BlazorBootstrap.Demo.RCL/Components/Pages/Charts/BarCharts/BarChart_Demo_02_Horizontal_BarChart.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
var dataset1 = new BarChartDataset()
1414
{
15-
Data = new List<double> { 55000, 15000, 18000, 21000 },
15+
Data = new List<double?> { 55000, 15000, 18000, 21000 },
1616
BackgroundColor = new List<string> { ColorUtility.CategoricalTwelveColors[0] },
1717
BorderColor = new List<string> { ColorUtility.CategoricalTwelveColors[0] },
1818
BorderWidth = new List<double> { 0 },

BlazorBootstrap.Demo.RCL/Components/Pages/Charts/BarCharts/BarChart_Demo_03_Stacked_BarChart.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
var dataset1 = new BarChartDataset()
1616
{
1717
Label = "Windows",
18-
Data = new List<double> { 28000, 8000, 2000, 17000 },
18+
Data = new List<double?> { 28000, 8000, 2000, 17000 },
1919
BackgroundColor = new List<string> { colors[0] },
2020
BorderColor = new List<string> { colors[0] },
2121
BorderWidth = new List<double> { 0 },
@@ -25,7 +25,7 @@
2525
var dataset2 = new BarChartDataset()
2626
{
2727
Label = "macOS",
28-
Data = new List<double> { 8000, 10000, 14000, 8000 },
28+
Data = new List<double?> { 8000, 10000, 14000, 8000 },
2929
BackgroundColor = new List<string> { colors[1] },
3030
BorderColor = new List<string> { colors[1] },
3131
BorderWidth = new List<double> { 0 },
@@ -35,7 +35,7 @@
3535
var dataset3 = new BarChartDataset()
3636
{
3737
Label = "Other",
38-
Data = new List<double> { 28000, 10000, 14000, 8000 },
38+
Data = new List<double?> { 28000, 10000, 14000, 8000 },
3939
BackgroundColor = new List<string> { colors[2] },
4040
BorderColor = new List<string> { colors[2] },
4141
BorderWidth = new List<double> { 0 },

BlazorBootstrap.Demo.RCL/Components/Pages/Charts/BarCharts/BarChart_Demo_04_Locale.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
var dataset1 = new BarChartDataset()
1616
{
1717
Label = "Windows",
18-
Data = new List<double> { 28000, 8000, 2000, 17000 },
18+
Data = new List<double?> { 28000, 8000, 2000, 17000 },
1919
BackgroundColor = new List<string> { colors[0] },
2020
BorderColor = new List<string> { colors[0] },
2121
BorderWidth = new List<double> { 0 },
@@ -25,7 +25,7 @@
2525
var dataset2 = new BarChartDataset()
2626
{
2727
Label = "macOS",
28-
Data = new List<double> { 8000, 10000, 14000, 8000 },
28+
Data = new List<double?> { 8000, 10000, 14000, 8000 },
2929
BackgroundColor = new List<string> { colors[1] },
3030
BorderColor = new List<string> { colors[1] },
3131
BorderWidth = new List<double> { 0 },
@@ -35,7 +35,7 @@
3535
var dataset3 = new BarChartDataset()
3636
{
3737
Label = "Other",
38-
Data = new List<double> { 28000, 10000, 14000, 8000 },
38+
Data = new List<double?> { 28000, 10000, 14000, 8000 },
3939
BackgroundColor = new List<string> { colors[2] },
4040
BorderColor = new List<string> { colors[2] },
4141
BorderWidth = new List<double> { 0 },

BlazorBootstrap.Demo.RCL/Components/Pages/Charts/BarCharts/BarChart_Demo_05_Stacked_BarChart_with_Datalabels.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
var dataset1 = new BarChartDataset()
1616
{
1717
Label = "Windows",
18-
Data = new List<double> { 28000, 8000, 2000, 17000 },
18+
Data = new List<double?> { 28000, 8000, 2000, 17000 },
1919
BackgroundColor = new List<string> { colors[0] },
2020
BorderColor = new List<string> { colors[0] },
2121
BorderWidth = new List<double> { 0 },
@@ -25,7 +25,7 @@
2525
var dataset2 = new BarChartDataset()
2626
{
2727
Label = "macOS",
28-
Data = new List<double> { 8000, 10000, 14000, 8000 },
28+
Data = new List<double?> { 8000, 10000, 14000, 8000 },
2929
BackgroundColor = new List<string> { colors[1] },
3030
BorderColor = new List<string> { colors[1] },
3131
BorderWidth = new List<double> { 0 },
@@ -35,7 +35,7 @@
3535
var dataset3 = new BarChartDataset()
3636
{
3737
Label = "Other",
38-
Data = new List<double> { 28000, 10000, 14000, 8000 },
38+
Data = new List<double?> { 28000, 10000, 14000, 8000 },
3939
BackgroundColor = new List<string> { colors[2] },
4040
BorderColor = new List<string> { colors[2] },
4141
BorderWidth = new List<double> { 0 },

BlazorBootstrap.Demo.RCL/Components/Pages/Charts/Charts_Demo_00_Examples.razor

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@
2626
new BarChartDataset()
2727
{
2828
Label = "India",
29-
Data = new List<double>{ 9, 11, 9, 4, 17, 16, 9, 11, 5, 14, 15, 6, 15, 9, 6, 8, 13, 3, 4, 11 },
29+
Data = new List<double?>{ 9, 11, 9, 4, 17, 16, 9, 11, 5, 14, 15, 6, 15, 9, 6, 8, 13, 3, 4, 11 },
3030
BackgroundColor = new List<string>{ "rgb(88, 80, 141)" },
3131
CategoryPercentage = 0.8,
3232
BarPercentage = 1,
3333
},
3434
new BarChartDataset()
3535
{
3636
Label = "England",
37-
Data = new List<double>{ 1, 0, 7, 11, 5, 2, 13, 8, 9, 10, 7, 13, 7, 5, 9, 5, 10, 5, 11, 2 },
37+
Data = new List<double?>{ 1, 0, 7, 11, 5, 2, 13, 8, 9, 10, 7, 13, 7, 5, 9, 5, 10, 5, 11, 2 },
3838
BackgroundColor = new List<string> { "rgb(255, 166, 0)" },
3939
CategoryPercentage = 0.8,
4040
BarPercentage = 1,
@@ -68,7 +68,7 @@
6868
new LineChartDataset()
6969
{
7070
Label = "India",
71-
Data = new List<double>{ 9, 20, 29, 33, 50, 66, 75, 86, 91, 105, 120, 126, 141, 150, 156, 164, 177, 180, 184, 195 },
71+
Data = new List<double?>{ 9, 20, 29, 33, 50, 66, 75, 86, 91, 105, 120, 126, 141, 150, 156, 164, 177, 180, 184, 195 },
7272
BackgroundColor = new List<string>{ "rgb(88, 80, 141)" },
7373
BorderColor = new List<string>{ "rgb(88, 80, 141)" },
7474
BorderWidth = new List<double>{2},
@@ -81,7 +81,7 @@
8181
new LineChartDataset()
8282
{
8383
Label = "England",
84-
Data = new List<double>{ 1, 1, 8, 19, 24, 26, 39, 47, 56, 66, 75, 88, 95, 100, 109, 114, 124, 129, 140, 142 },
84+
Data = new List<double?>{ 1, 1, 8, 19, 24, 26, 39, 47, 56, 66, 75, 88, 95, 100, 109, 114, 124, 129, 140, 142 },
8585
BackgroundColor = new List<string>{ "rgb(255, 166, 0)" },
8686
BorderColor = new List<string>{ "rgb(255, 166, 0)" },
8787
BorderWidth = new List<double>{2},

BlazorBootstrap.Demo.RCL/Components/Pages/Charts/DoughnutCharts/DoughnutChart_Demo_01_Examples.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
{
5151
var count = doughnutChartDataset.Data.Count;
5252

53-
var newData = new List<double>();
53+
var newData = new List<double?>();
5454
for (var i = 0; i < count; i++)
5555
{
5656
newData.Add(random.Next(0, 100));
@@ -116,9 +116,9 @@
116116
return new() { Label = $"Team {datasetsCount}", Data = GetRandomData(), BackgroundColor = GetRandomBackgroundColors() };
117117
}
118118

119-
private List<double> GetRandomData()
119+
private List<double?> GetRandomData()
120120
{
121-
var data = new List<double>();
121+
var data = new List<double?>();
122122
for (var index = 0; index < dataLabelsCount; index++)
123123
{
124124
data.Add(random.Next(0, 100));

BlazorBootstrap.Demo.RCL/Components/Pages/Charts/DoughnutCharts/DoughnutChart_Demo_02_Datalabels.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
{
5252
var count = doughnutChartDataset.Data.Count;
5353

54-
var newData = new List<double>();
54+
var newData = new List<double?>();
5555
for (var i = 0; i < count; i++)
5656
{
5757
newData.Add(random.Next(0, 100));
@@ -118,9 +118,9 @@
118118
return new() { Label = $"Team {datasetsCount}", Data = GetRandomData(), BackgroundColor = GetRandomBackgroundColors() };
119119
}
120120

121-
private List<double> GetRandomData()
121+
private List<double?> GetRandomData()
122122
{
123-
var data = new List<double>();
123+
var data = new List<double?>();
124124
for (var index = 0; index < dataLabelsCount; index++)
125125
{
126126
data.Add(random.Next(0, 100));

BlazorBootstrap.Demo.RCL/Components/Pages/Charts/LineCharts/LineChart_Demo_01_A_Examples.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
{
4747
var count = lineChartDataset.Data.Count;
4848

49-
var newData = new List<double>();
49+
var newData = new List<double?>();
5050
for (var i = 0; i < count; i++)
5151
{
5252
newData.Add(random.Next(200));
@@ -131,9 +131,9 @@
131131
};
132132
}
133133

134-
private List<double> GetRandomData()
134+
private List<double?> GetRandomData()
135135
{
136-
var data = new List<double>();
136+
var data = new List<double?>();
137137
for (var index = 0; index < labelsCount; index++)
138138
{
139139
data.Add(random.Next(200));

BlazorBootstrap.Demo.RCL/Components/Pages/Charts/LineCharts/LineChart_Demo_01_B_Examples.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
var dataset1 = new LineChartDataset
1616
{
1717
Label = "Windows",
18-
Data = new List<double> { 7265791, 5899643, 6317759, 6315641, 5338211, 8496306, 7568556, 8538933, 8274297, 8657298, 7548388, 7764845 },
18+
Data = new List<double?> { 7265791, 5899643, 6317759, 6315641, 5338211, 8496306, 7568556, 8538933, 8274297, 8657298, 7548388, 7764845 },
1919
BackgroundColor = new List<string> { colors[0] },
2020
BorderColor = new List<string> { colors[0] },
2121
BorderWidth = new List<double> { 2 },
@@ -29,7 +29,7 @@
2929
var dataset2 = new LineChartDataset
3030
{
3131
Label = "macOS",
32-
Data = new List<double> { 1809499, 1816642, 2122410, 1809499, 1850793, 1846743, 1954797, 2391313, 1983430, 2469918, 2633303, 2821149 },
32+
Data = new List<double?> { 1809499, 1816642, 2122410, 1809499, 1850793, 1846743, 1954797, 2391313, 1983430, 2469918, 2633303, 2821149 },
3333
BackgroundColor = new List<string> { colors[1] },
3434
BorderColor = new List<string> { colors[1] },
3535
BorderWidth = new List<double> { 2 },
@@ -43,7 +43,7 @@
4343
var dataset3 = new LineChartDataset
4444
{
4545
Label = "Other",
46-
Data = new List<double> { 1081241, 1100363, 1118136, 1073255, 1120315, 1395736, 1488788, 1489466, 1489947, 1414739, 1735811, 1820171 },
46+
Data = new List<double?> { 1081241, 1100363, 1118136, 1073255, 1120315, 1395736, 1488788, 1489466, 1489947, 1414739, 1735811, 1820171 },
4747
BackgroundColor = new List<string> { colors[2] },
4848
BorderColor = new List<string> { colors[2] },
4949
BorderWidth = new List<double> { 2 },

0 commit comments

Comments
 (0)