This commit is contained in:
henry.zhang 2020-08-12 23:01:13 +08:00 коммит произвёл TimChen
Родитель 61bb352ee5
Коммит 1ef4ebc55d
6 изменённых файлов: 11419 добавлений и 23 удалений

Просмотреть файл

@ -16,17 +16,17 @@
</ChildContent>
</TabPane>
@*<TabPane Key="3">
<Tab>示例3</Tab>
<ChildContent>
<Bubble @ref="chart3" Data="data3" Config="config3" />
</ChildContent>
</TabPane>
<TabPane Key="4">
<Tab>示例4</Tab>
<ChildContent>
<Bubble @ref="chart4" Data="data4" Config="config4" />
</ChildContent>
</TabPane>*@
<Tab>示例3</Tab>
<ChildContent>
<Bubble @ref="chart3" Data="data3" Config="config3" />
</ChildContent>
</TabPane>
<TabPane Key="4">
<Tab>示例4</Tab>
<ChildContent>
<Bubble @ref="chart4" Data="data4" Config="config4" />
</ChildContent>
</TabPane>*@
</Tabs>
@code{
@ -38,19 +38,26 @@
IChartComponent chart2;
SmokingRateItem[] data2;
//IChartComponent chart3;
//RevenueItem[] data3;
IChartComponent chart3;
RevenueItem[] data3;
//IChartComponent chart4;
//SmokingRateItem[] data4;
IChartComponent chart4;
LifeExpectanyItem[] data4;
protected override async Task OnInitializedAsync()
{
data1 = await DemoData.SmokingRateAsync(NavigationManager, HttpClient);
data2 = data1;
await chart1.ChangeData(data1);
await chart2.ChangeData(data2);
data2 = data1;
await chart2.ChangeData(data1);
//var t1 = await DemoData.RevenueItemAsync(NavigationManager, HttpClient);
//data3 = await DemoData.RevenueItemAsync(NavigationManager, HttpClient);
//await chart3.ChangeData(data3);
//data4 = await DemoData.LifeExpectanyItemAsync(NavigationManager, HttpClient);
//await chart4.ChangeData(data4);
await base.OnInitializedAsync();
}
@ -110,10 +117,10 @@
new {fill= "#a3dda1", opacity= 0.1},
new {fill= "white", opacity= 0},
new {fill="#d8d0c0", opacity=0.2}
},
Label = new
},
Label = new
{
Text = new[]
Text = new []
{
"Female decrease,\nmale increase",
"Female & male decrease",
@ -125,4 +132,133 @@
};
#endregion 示例2
}
#region 示例3
//smoking-rate
readonly BubbleConfig config3 = new BubbleConfig
{
XField = "Revenue_per_club",
YField = "UEFA_points",
SizeField = "UEFA_points",
PointSize = new[] { 4, 25 },
ColorField = new[] { "revenueGroup" },
Color = new[] { "#72302f", "#beb298", "#d18768", "#e3cda1" }, //#72302f', '#beb298', '#d18768', '#e3cda1']
PointStyle = new GraphicStyle
{
Stroke = "#777777",
LineWidth = 1,
Opacity = 0.9,
},
XAxis = new ValueTimeAxis
{
Visible = true,
Max = 230,
Min = -5,
Nice = false,
},
Trendline = new TrendlineConfig
{
Visible=true,
Type="log",
}
};
#endregion 示例3
#region 示例4
//smoking-rate
readonly BubbleConfig config4 = new BubbleConfig
{
XField = "income",
YField = "lifeExpectancy",
SizeField = "population",
ColorField = "country",
PointSize= new[] {4,80},
Color = new[]{
"#5B8FF9",
"#5AD8A6",
"#f03838",
"#35d1d1",
"#E8684A",
"#6DC8EC",
"#9270CA",
"#FF9D4D",
"#F6BD16",
"#FF99C3",
},
ForceFit = true,
PointStyle = new GraphicStyle
{
Stroke = "#777777",
LineWidth = 1,
Opacity = 0.8,
},
XAxis = new ValueTimeAxis
{
Visible = true,
Max = 100000,
Min = 300,
Nice=false,
Type="log",
Title= new BaseAxisTitle
{
Visible=true,
Text = "人均收入",
}
},
YAxis = new ValueTimeAxis
{
Visible = true,
Max = 100,
Min = 0,
Title = new BaseAxisTitle
{
Visible = true,
Text = "人均寿命",
}
},
Tooltip = new Charts.Tooltip
{
Visible=true,
ShowTitle = true,
TitleField="country",
Fields = new[]
{
"income",
"liftExpectany",
"population",
}
},
Label = new Label
{
Visible=true,
Field="country",
},
Interactions = new Interaction[]
{
new Interaction
{
Type="timeline",
Cfg = new
{
field = "year",
key = "country",
loop = true,
}
}
},
};
#endregion 示例4
}

Просмотреть файл

@ -75,6 +75,18 @@ namespace AntDesign.Charts.Docs.Demos
{
return await HttpClient.GetFromJsonAsync<FertilityItem[]>("https://gw.alipayobjects.com/os/antvdemo/assets/data/fertility.json");
}
public static async Task<RevenueItem[]> RevenueItemAsync(NavigationManager NavigationManager, HttpClient HttpClient)
{
var baseUrl = NavigationManager.ToAbsoluteUri(NavigationManager.BaseUri);
return await HttpClient.GetFromJsonAsync<RevenueItem[]>(new Uri(baseUrl, "_content/AntDesign.Charts.Docs/data/revenue.json").ToString());
}
public static async Task<LifeExpectanyItem[]> LifeExpectanyItemAsync(NavigationManager NavigationManager, HttpClient HttpClient)
{
var baseUrl = NavigationManager.ToAbsoluteUri(NavigationManager.BaseUri);
return await HttpClient.GetFromJsonAsync<LifeExpectanyItem[]>(new Uri(baseUrl, "_content/AntDesign.Charts.Docs/data/life-expectancy.json").ToString());
}
}
public class FireworksSalesItem
@ -188,5 +200,39 @@ namespace AntDesign.Charts.Docs.Demos
public object value { get; set; }
}
public class LifeExpectanyItem
{
public long income { get; set; }
public double liftExpectancy { get; set; }
public long population { get; set; }
public string country { get; set; }
public int year { get; set; }
}
//"UEFA rank": 9,
//"country": "Belgium",
//"UEFA points*": 38.5,
//"Clubs": "0/5",
//"Revenue per club[€ m]": 19.7,
//"revenueGroup": "€5M to €50M"
public class RevenueItem
{
[JsonPropertyName("UEFA rank")]
public int UEFA_rank { get; set; }
public string country { get; set; }
[JsonPropertyName("UEFA points*")]
public double UEFA_points { get; set; }
public string Clubs { get; set; }
[JsonPropertyName("URevenue per club[€ m]")]
public double Revenue_per_club { get; set; }
public string revenueGroup { get; set; }
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,434 @@
[
{
"UEFA rank": 1,
"country": "Spain",
"UEFA points*": 98.284,
"Clubs": "7/7",
"Revenue per club[€ m]": 102.3,
"revenueGroup": "€50M+"
},
{
"UEFA rank": 2,
"country": "England",
"UEFA points*": 71.748,
"Clubs": "6/7",
"Revenue per club[€ m]": 220.3,
"revenueGroup": "€50M+"
},
{
"UEFA rank": 3,
"country": "Italy",
"UEFA points*": 69.749,
"Clubs": "6/6",
"Revenue per club[€ m]": 95.2,
"revenueGroup": "€50M+"
},
{
"UEFA rank": 4,
"country": "Germany",
"UEFA points*": 67.57,
"Clubs": "3/7",
"Revenue per club[€ m]": 134.5,
"revenueGroup": "€50M+"
},
{
"UEFA rank": 5,
"country": "France",
"UEFA points*": 52.415,
"Clubs": "4/6",
"Revenue per club[€ m]": 70.9,
"revenueGroup": "€50M+"
},
{
"UEFA rank": 6,
"country": "Russia",
"UEFA points*": 50.182,
"Clubs": "4/5",
"Revenue per club[€ m]": 46.4,
"revenueGroup": "€5M to €50M"
},
{
"UEFA rank": 7,
"country": "Portugal",
"UEFA points*": 44.582,
"Clubs": "3/6",
"Revenue per club[€ m]": 19.1,
"revenueGroup": "€5M to €50M"
},
{
"UEFA rank": 8,
"country": "Ukraine",
"UEFA points*": 39.133,
"Clubs": "2/5",
"Revenue per club[€ m]": 12.5,
"revenueGroup": "€5M to €50M"
},
{
"UEFA rank": 9,
"country": "Belgium",
"UEFA points*": 38.5,
"Clubs": "0/5",
"Revenue per club[€ m]": 19.7,
"revenueGroup": "€5M to €50M"
},
{
"UEFA rank": 10,
"country": "Turkey",
"UEFA points*": 34.8,
"Clubs": "1/5",
"Revenue per club[€ m]": 36,
"revenueGroup": "€5M to €50M"
},
{
"UEFA rank": 11,
"country": "Austria",
"UEFA points*": 29.85,
"Clubs": "1/4",
"Revenue per club[€ m]": 12.9,
"revenueGroup": "€5M to €50M"
},
{
"UEFA rank": 12,
"country": "Netherlands",
"UEFA points*": 29.749,
"Clubs": "0/5",
"Revenue per club[€ m]": 24.9,
"revenueGroup": "€5M to €50M"
},
{
"UEFA rank": 13,
"country": "Czech Republic",
"UEFA points*": 29.175,
"Clubs": "1/5",
"Revenue per club[€ m]": 3.2,
"revenueGroup": "€1M to €5M"
},
{
"UEFA rank": 14,
"country": "Switzerland",
"UEFA points*": 28.8,
"Clubs": "1/5",
"Revenue per club[€ m]": 21.1,
"revenueGroup": "€5M to €50M"
},
{
"UEFA rank": 15,
"country": "Greece",
"UEFA points*": 28.2,
"Clubs": "1/5",
"Revenue per club[€ m]": 7.8,
"revenueGroup": "€5M to €50M"
},
{
"UEFA rank": 16,
"country": "Croatia",
"UEFA points*": 26,
"Clubs": "0/4",
"Revenue per club[€ m]": 4.3,
"revenueGroup": "€1M to €5M"
},
{
"UEFA rank": 17,
"country": "Denmark",
"UEFA points*": 25.95,
"Clubs": "1/4",
"Revenue per club[€ m]": 11.9,
"revenueGroup": "€5M to €50M"
},
{
"UEFA rank": 18,
"country": "Israel",
"UEFA points*": 21.75,
"Clubs": "0/4",
"Revenue per club[€ m]": 4.4,
"revenueGroup": "€1M to €5M"
},
{
"UEFA rank": 19,
"country": "Cyprus",
"UEFA points*": 21.55,
"Clubs": "0/4",
"Revenue per club[€ m]": 3.3,
"revenueGroup": "€1M to €5M"
},
{
"UEFA rank": 20,
"country": "Poland",
"UEFA points*": 20.125,
"Clubs": "0/4",
"Revenue per club[€ m]": 6.7,
"revenueGroup": "€5M to €50M"
},
{
"UEFA rank": 21,
"country": "Romania",
"UEFA points*": 20.05,
"Clubs": "1/5",
"Revenue per club[€ m]": 5.1,
"revenueGroup": "€5M to €50M"
},
{
"UEFA rank": 22,
"country": "Sweden",
"UEFA points*": 19.475,
"Clubs": "1/4",
"Revenue per club[€ m]": 10.4,
"revenueGroup": "€5M to €50M"
},
{
"UEFA rank": 23,
"country": "Azerbaijan",
"UEFA points*": 19.125,
"Clubs": "0/4",
"Revenue per club[€ m]": 4,
"revenueGroup": "€1M to €5M"
},
{
"UEFA rank": 24,
"country": "Bulgaria",
"UEFA points*": 19.125,
"Clubs": "1/4",
"Revenue per club[€ m]": 4.2,
"revenueGroup": "€1M to €5M"
},
{
"UEFA rank": 25,
"country": "Belarus",
"UEFA points*": 18.625,
"Clubs": "0/4",
"Revenue per club[€ m]": 4.2,
"revenueGroup": "€1M to €5M"
},
{
"UEFA rank": 26,
"country": "Serbia",
"UEFA points*": 18.25,
"Clubs": "2/4",
"Revenue per club[€ m]": 1.6,
"revenueGroup": "€1M to €5M"
},
{
"UEFA rank": 27,
"country": "Scotland",
"UEFA points*": 18.125,
"Clubs": "1/4",
"Revenue per club[€ m]": 11.1,
"revenueGroup": "€5M to €50M"
},
{
"UEFA rank": 28,
"country": "Kazakhstan",
"UEFA points*": 17.875,
"Clubs": "1/4",
"Revenue per club[€ m]": 11.1,
"revenueGroup": "€5M to €50M"
},
{
"UEFA rank": 29,
"country": "Norway",
"UEFA points*": 17.425,
"Clubs": "0/4",
"Revenue per club[€ m]": 9,
"revenueGroup": "€5M to €50M"
},
{
"UEFA rank": 30,
"country": "Slovenia",
"UEFA points*": 14.5,
"Clubs": "0/4",
"Revenue per club[€ m]": 1.5,
"revenueGroup": "€1M to €5M"
},
{
"UEFA rank": 31,
"country": "Liechtenstein",
"UEFA points*": 13,
"Clubs": "0/1",
"Revenue per club[€ m]": 1.5,
"revenueGroup": "€1M to €5M"
},
{
"UEFA rank": 32,
"country": "Slovakia",
"UEFA points*": 12.125,
"Clubs": "0/4",
"Revenue per club[€ m]": 2.2,
"revenueGroup": "€1M to €5M"
},
{
"UEFA rank": 33,
"country": "Moldova",
"UEFA points*": 10,
"Clubs": "0/4",
"Revenue per club[€ m]": 0.6,
"revenueGroup": "€0.1M to €1M"
},
{
"UEFA rank": 34,
"country": "Albania",
"UEFA points*": 8.5,
"Clubs": "0/4",
"Revenue per club[€ m]": 0.7,
"revenueGroup": "€0.1M to €1M"
},
{
"UEFA rank": 35,
"country": "Iceland",
"UEFA points*": 8.25,
"Clubs": "0/4",
"Revenue per club[€ m]": 1.1,
"revenueGroup": "€1M to €5M"
},
{
"UEFA rank": 36,
"country": "Hungary",
"UEFA points*": 8.125,
"Clubs": "0/4",
"Revenue per club[€ m]": 5.5,
"revenueGroup": "€5M to €50M"
},
{
"UEFA rank": 37,
"country": "FYR Macedonia",
"UEFA points*": 7.5,
"Clubs": "0/4",
"Revenue per club[€ m]": 0.8,
"revenueGroup": "€0.1M to €1M"
},
{
"UEFA rank": 38,
"country": "Finland",
"UEFA points*": 6.9,
"Clubs": "0/4",
"Revenue per club[€ m]": 2,
"revenueGroup": "€1M to €5M"
},
{
"UEFA rank": 39,
"country": "Republic of Ireland",
"UEFA points*": 6.7,
"Clubs": "0/4",
"Revenue per club[€ m]": 0.9,
"revenueGroup": "€0.1M to €1M"
},
{
"UEFA rank": 40,
"country": "Bosnia and Herzegovina",
"UEFA points*": 6.625,
"Clubs": "0/4",
"Revenue per club[€ m]": 0.6,
"revenueGroup": "€0.1M to €1M"
},
{
"UEFA rank": 41,
"country": "Latvia",
"UEFA points*": 5.625,
"Clubs": "0/4",
"Revenue per club[€ m]": 0.4,
"revenueGroup": "€0.1M to €1M"
},
{
"UEFA rank": 42,
"country": "Estonia",
"UEFA points*": 5.5,
"Clubs": "0/4",
"Revenue per club[€ m]": 0.4,
"revenueGroup": "€0.1M to €1M"
},
{
"UEFA rank": 43,
"country": "Lithuania",
"UEFA points*": 5.375,
"Clubs": "0/4",
"Revenue per club[€ m]": 0.6,
"revenueGroup": "€0.1M to €1M"
},
{
"UEFA rank": 44,
"country": "Montenegro",
"UEFA points*": 5,
"Clubs": "0/4",
"Revenue per club[€ m]": 0.4,
"revenueGroup": "€0.1M to €1M"
},
{
"UEFA rank": 45,
"country": "Georgia",
"UEFA points*": 5,
"Clubs": "0/4",
"Revenue per club[€ m]": 0.7,
"revenueGroup": "€0.1M to €1M"
},
{
"UEFA rank": 46,
"country": "Armenia",
"UEFA points*": 4.875,
"Clubs": "0/4",
"Revenue per club[€ m]": 0.5,
"revenueGroup": "€0.1M to €1M"
},
{
"UEFA rank": 47,
"country": "Malta",
"UEFA points*": 4.5,
"Clubs": "0/4",
"Revenue per club[€ m]": 0.4,
"revenueGroup": "€0.1M to €1M"
},
{
"UEFA rank": 48,
"country": "Luxembourg",
"UEFA points*": 4.375,
"Clubs": "0/4",
"Revenue per club[€ m]": 0.7,
"revenueGroup": "€0.1M to €1M"
},
{
"UEFA rank": 49,
"country": "Northern Ireland",
"UEFA points*": 4.25,
"Clubs": "0/4",
"Revenue per club[€ m]": 0.8,
"revenueGroup": "€0.1M to €1M"
},
{
"UEFA rank": 50,
"country": "Wales",
"UEFA points*": 3.875,
"Clubs": "0/4",
"Revenue per club[€ m]": 0.5,
"revenueGroup": "€0.1M to €1M"
},
{
"UEFA rank": 51,
"country": "Faroe Islands",
"UEFA points*": 3.75,
"Clubs": "0/4",
"Revenue per club[€ m]": 0.5,
"revenueGroup": "€0.1M to €1M"
},
{
"UEFA rank": 52,
"country": "Gibraltar",
"UEFA points*": 3,
"Clubs": "0/3",
"Revenue per club[€ m]": 0.3,
"revenueGroup": "€0.1M to €1M"
},
{
"UEFA rank": 53,
"country": "Andorra",
"UEFA points*": 1.331,
"Clubs": "0/3",
"Revenue per club[€ m]": 0.2,
"revenueGroup": "€0.1M to €1M"
},
{
"UEFA rank": 54,
"country": "San Marino",
"UEFA points*": 0.499,
"Clubs": "0/3",
"Revenue per club[€ m]": 0.1,
"revenueGroup": "€0.1M to €1M"
}
]

Просмотреть файл

@ -75,6 +75,9 @@ namespace AntDesign.Charts
public bool? AutoRotate { get; set; }
[JsonPropertyName("field")]
public string Field { get; set; }
[JsonPropertyName("text")]
public string[] Text { get; set; }
}
}

Просмотреть файл

@ -142,7 +142,7 @@ namespace AntDesign.Charts
[JsonPropertyName("lineStyle")]
public object LineStyle { get; set; }
[JsonPropertyName("label")]
public OneOf<object, Label> Label { get; set; }
public OneOf<Label, object> Label { get; set; }
}
public class QuadrantConfig : IQuadrantConfig
@ -159,8 +159,10 @@ namespace AntDesign.Charts
public object RegionStyleMapping => RegionStyle.Value;
[JsonPropertyName("lineStyle")]
public object LineStyle { get; set; }
[JsonIgnore]
public OneOf<Label, object> Label { get; set; }
[JsonPropertyName("label")]
public OneOf<object, Label> Label { get; set; }
public object LabelMapping => Label.Value;
}
public interface ITrendlineConfig