Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
liuliang-wt committed Sep 2, 2021
1 parent 0baefab commit cdb9645
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 228 deletions.
39 changes: 0 additions & 39 deletions demo/WalkingTec.Mvvm.Demo/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,45 +36,6 @@ public IActionResult PIndex()
[ActionDescription("FrontPage")]
public IActionResult FrontPage()
{
var areas = GlobaInfo.AllModule.Select(x => x.Area).Distinct();
var legend = new List<string>();
var series = new List<object>();
foreach (var area in areas)
{
var legendName = area?.AreaName ?? "Default";
var controllers = GlobaInfo.AllModule.Where(x => x.Area == area);
legend.Add(legendName);
series.Add(new
{
name = legendName,
type = "bar",
data = new int[] {
controllers.Count(),
controllers.SelectMany(x => x.Actions).Count()
},
});
}

var otherLegend = new List<string>() { "Info" };
var otherSeries = new List<object>()
{
new {
name = "Info",
type = "bar",
data = new int[] {
10,
Wtm.GlobaInfo.AllAssembly.Count(),
Wtm.DataPrivilegeSettings.Count(),
Wtm.ConfigInfo.Connections.Count(),
Wtm.ConfigInfo.AppSettings.Count()
},
}
};

ViewData["controller.legend"] = legend;
ViewData["controller.series"] = series;
ViewData["other.legend"] = otherLegend;
ViewData["other.series"] = otherSeries;

return PartialView();
}
Expand Down
195 changes: 6 additions & 189 deletions demo/WalkingTec.Mvvm.Demo/Views/Home/FrontPage.en.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -127,38 +127,24 @@
<div class="layui-col-md6">
<div class="layui-card">
<div class="layui-card-header">Controllers</div>
<div class="layui-carousel layadmin-carousel layadmin-dataview">
<div carousel-item>
<div id="chart_Controller" style=" height:300px;">
</div>
</div>
<div class="layui-card-body">
<wt:chart is-horizontal="true" show-legend="true" show-tooltip="true" type="Bar" height="300" trigger-url="/Home/GetActionChart" />
</div>
</div>
</div>
<div class="layui-col-md6">
<div class="layui-card">
<div class="layui-card-header">Others</div>
<div class="layui-carousel layadmin-carousel layadmin-dataview">
<div carousel-item>
<div id="chart_Other" style=" height:300px;">
</div>
</div>
<div class="layui-card-header">Models</div>
<div class="layui-card-body">
<wt:chart show-legend="false" show-tooltip="true" type="Pie" height="300" trigger-url="/Home/GetModelChart" />
</div>
</div>
</div>
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header">Mock data</div>
<div class="layui-card-body">

<div class="layui-carousel layadmin-carousel layadmin-dataview" data-anim="fade"
lay-filter="LAY-index-dataview">
<div carousel-item id="LAY-index-dataview">
<div><i class="layui-icon layui-icon-loading1 layadmin-loading"></i></div>
<div></div>
<div></div>
</div>
</div>
<wt:chart is-horizontal="true" type="Scatter" height="400" trigger-url="/Home/GetSampleChart" radius="50" name-x="X" name-y="Y" name-category="C" name-addition="A" />

</div>
</div>
Expand Down Expand Up @@ -276,173 +262,4 @@
});
//数据概览
layui.use(['admin', 'carousel', 'echarts'], function () {
var $ = layui.$
, admin = layui.admin
, carousel = layui.carousel
, echarts = layui.echarts;
var control = echarts.init(document.getElementById('chart_Controller'), 'default');
var controlOption = {
title: { text: 'Controller' },
tooltip: {},
legend: {
data: @Html.Raw(JsonSerializer.Serialize(ViewData["controller.legend"]))
},
xAxis: {},
yAxis: {
data: ['Controller', 'Action']
},
series: @Html.Raw(JsonSerializer.Serialize(ViewData["controller.series"]))
};
control.setOption(controlOption);
var other = echarts.init(document.getElementById('chart_Other'), 'default');
var otherOption = {
title: { text: 'Others' },
tooltip: {},
xAxis: {},
yAxis: {
data: ['Model', 'Dll', 'DataPri', 'ConnectionString', 'App Settings']
},
series: @Html.Raw(JsonSerializer.Serialize(ViewData["other.series"]))
};
other.setOption(otherOption);
var echartsApp = [], options = [
//今日流量趋势
{
title: {
text: 'Today\'s traffic trends',
x: 'center',
textStyle: {
fontSize: 14
}
},
tooltip: {
trigger: 'axis'
},
legend: {
data: ['', '']
},
xAxis: [{
type: 'category',
boundaryGap: false,
data: ['06:00', '06:30', '07:00', '07:30', '08:00', '08:30', '09:00', '09:30', '10:00', '11:30', '12:00', '12:30', '13:00', '13:30', '14:00', '14:30', '15:00', '15:30', '16:00', '16:30', '17:00', '17:30', '18:00', '18:30', '19:00', '19:30', '20:00', '20:30', '21:00', '21:30', '22:00', '22:30', '23:00', '23:30']
}],
yAxis: [{
type: 'value'
}],
series: [{
name: 'PV',
type: 'line',
smooth: true,
itemStyle: { normal: { areaStyle: { type: 'default' } } },
data: [111, 222, 333, 444, 555, 666, 3333, 33333, 55555, 66666, 33333, 3333, 6666, 11888, 26666, 38888, 56666, 42222, 39999, 28888, 17777, 9666, 6555, 5555, 3333, 2222, 3111, 6999, 5888, 2777, 1666, 999, 888, 777]
}, {
name: 'UV',
type: 'line',
smooth: true,
itemStyle: { normal: { areaStyle: { type: 'default' } } },
data: [11, 22, 33, 44, 55, 66, 333, 3333, 5555, 12666, 3333, 333, 666, 1188, 2666, 3888, 6666, 4222, 3999, 2888, 1777, 966, 655, 555, 333, 222, 311, 699, 588, 277, 166, 99, 88, 77]
}]
},
//访客浏览器分布
{
title: {
text: 'Visitor browser distribution',
x: 'center',
textStyle: {
fontSize: 14
}
},
tooltip: {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
legend: {
orient: 'vertical',
x: 'left',
data: ['Chrome', 'Firefox', 'IE 8.0', 'Safari', 'Others']
},
series: [{
name: 'Access source',
type: 'pie',
radius: '55%',
center: ['50%', '50%'],
data: [
{ value: 9052, name: 'Chrome' },
{ value: 1610, name: 'Firefox' },
{ value: 3200, name: 'IE 8.0' },
{ value: 535, name: 'Safari' },
{ value: 1700, name: 'Others' }
]
}]
},
//新增的用户量
{
title: {
text: 'New users in the last week',
x: 'center',
textStyle: {
fontSize: 14
}
},
tooltip: { //提示框
trigger: 'axis',
formatter: "{b}<br>New users:{c}"
},
xAxis: [{ //X轴
type: 'category',
data: ['11-07', '11-08', '11-09', '11-10', '11-11', '11-12', '11-13']
}],
yAxis: [{ //Y轴
type: 'value'
}],
series: [{ //内容
type: 'line',
data: [200, 300, 400, 610, 150, 270, 380],
}]
}
]
, elemDataView = $('#LAY-index-dataview').children('div')
, renderDataView = function (index) {
echartsApp[index] = echarts.init(elemDataView[index], layui.echartsTheme);
echartsApp[index].setOption(options[index]);
//window.onresize = echartsApp[index].resize;
admin.resize(function () {
echartsApp[index].resize();
control.resize();
other.resize();
});
};
//没找到DOM,终止执行
if (!elemDataView[0]) return;
renderDataView(0);
//监听数据概览轮播
var carouselIndex = 0;
carousel.on('change(LAY-index-dataview)', function (obj) {
renderDataView(carouselIndex = obj.index);
});
//监听侧边伸缩
layui.admin.on('side', function () {
setTimeout(function () {
renderDataView(carouselIndex);
}, 300);
});
//监听路由
layui.admin.on('hash(tab)', function () {
layui.router().path.join('') || renderDataView(carouselIndex);
});
});
</script>

0 comments on commit cdb9645

Please sign in to comment.