mirror of https://github.com/abpframework/abp.git
19 changed files with 34183 additions and 11 deletions
@ -0,0 +1,13 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace DashboardDemo |
|||
{ |
|||
public interface IUserStatisticAppService : IApplicationService |
|||
{ |
|||
Task<NewUserPerDayStatisticDto> GetNewUserPerDayStatistic(); |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
namespace DashboardDemo |
|||
{ |
|||
public class NewUserPerDayStatisticDto |
|||
{ |
|||
public int[] Data { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Services; |
|||
|
|||
namespace DashboardDemo |
|||
{ |
|||
public class UserStatisticAppService : ApplicationService, IUserStatisticAppService |
|||
{ |
|||
public async Task<NewUserPerDayStatisticDto> GetNewUserPerDayStatistic() |
|||
{ |
|||
var data = Enumerable |
|||
.Repeat(0, 7) |
|||
.Select(i => new Random().Next(50, 99)) |
|||
.ToArray(); |
|||
|
|||
return new NewUserPerDayStatisticDto{Data = data}; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Bundling; |
|||
|
|||
namespace DashboardDemo.Pages.widgets.Chartjs |
|||
{ |
|||
public class ChartjsScriptContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
context.Files.Add("/libs/chart.js/Chart.js"); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Bundling; |
|||
using Volo.Abp.AspNetCore.Mvc.UI.Packages.Clipboard; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace DashboardDemo.Pages.widgets.Chartjs |
|||
{ |
|||
public class ChartjsStyleContributor : BundleContributor |
|||
{ |
|||
public override void ConfigureBundle(BundleConfigurationContext context) |
|||
{ |
|||
context.Files.Add("/libs/chart.js/Chart.css"); |
|||
} |
|||
} |
|||
} |
|||
|
|||
@ -1,10 +1,39 @@ |
|||
(function ($) { |
|||
|
|||
var $container = $('#UserCountWidgetContainer'); |
|||
if ($container.length > 0) { |
|||
|
|||
var _identityUserAppService = volo.abp.identity.identityUser; |
|||
_identityUserAppService.getList({}).then(function(result) { |
|||
_identityUserAppService.getList({}).then(function (result) { |
|||
$container.find('#UserCount').text(result.items.length); |
|||
}); |
|||
|
|||
var createChart = function() { |
|||
dashboardDemo.userStatistic.getNewUserPerDayStatistic().then(function (result) { |
|||
console.log(result.data); |
|||
|
|||
var chart = new Chart($container.find('#UserStatistics'), { |
|||
type: 'bar', |
|||
data: { |
|||
labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', "Sun"], |
|||
datasets: [{ |
|||
label: 'Avarage new user per day', |
|||
data: result.data, |
|||
backgroundColor: 'rgba(255, 99, 132, 0.2)' |
|||
}] |
|||
}, |
|||
options: { |
|||
scales: { |
|||
yAxes: [{ |
|||
ticks: { |
|||
beginAtZero: true |
|||
} |
|||
}] |
|||
} |
|||
} |
|||
}); |
|||
}); |
|||
}; |
|||
|
|||
createChart(); |
|||
} |
|||
})(jQuery); |
|||
|
|||
@ -1,8 +1,7 @@ |
|||
module.exports = { |
|||
aliases: { |
|||
|
|||
}, |
|||
mappings: { |
|||
|
|||
"@node_modules/chart.js/dist/*.*": "@libs/chart.js/" |
|||
//"@node_modules/chartjs-color/*.*": "@libs/chartjs-color/",
|
|||
//"@node_modules/chartjs-color-string/*.*": "@libs/chartjs-color-string/"
|
|||
} |
|||
}; |
|||
|
|||
File diff suppressed because it is too large
File diff suppressed because one or more lines are too long
@ -0,0 +1,47 @@ |
|||
/* |
|||
* DOM element rendering detection |
|||
* https://davidwalsh.name/detect-node-insertion |
|||
*/ |
|||
@keyframes chartjs-render-animation { |
|||
from { opacity: 0.99; } |
|||
to { opacity: 1; } |
|||
} |
|||
|
|||
.chartjs-render-monitor { |
|||
animation: chartjs-render-animation 0.001s; |
|||
} |
|||
|
|||
/* |
|||
* DOM element resizing detection |
|||
* https://github.com/marcj/css-element-queries |
|||
*/ |
|||
.chartjs-size-monitor, |
|||
.chartjs-size-monitor-expand, |
|||
.chartjs-size-monitor-shrink { |
|||
position: absolute; |
|||
direction: ltr; |
|||
left: 0; |
|||
top: 0; |
|||
right: 0; |
|||
bottom: 0; |
|||
overflow: hidden; |
|||
pointer-events: none; |
|||
visibility: hidden; |
|||
z-index: -1; |
|||
} |
|||
|
|||
.chartjs-size-monitor-expand > div { |
|||
position: absolute; |
|||
width: 1000000px; |
|||
height: 1000000px; |
|||
left: 0; |
|||
top: 0; |
|||
} |
|||
|
|||
.chartjs-size-monitor-shrink > div { |
|||
position: absolute; |
|||
width: 200%; |
|||
height: 200%; |
|||
left: 0; |
|||
top: 0; |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1 @@ |
|||
@keyframes chartjs-render-animation{from{opacity:.99}to{opacity:1}}.chartjs-render-monitor{animation:chartjs-render-animation 1ms}.chartjs-size-monitor,.chartjs-size-monitor-expand,.chartjs-size-monitor-shrink{position:absolute;direction:ltr;left:0;top:0;right:0;bottom:0;overflow:hidden;pointer-events:none;visibility:hidden;z-index:-1}.chartjs-size-monitor-expand>div{position:absolute;width:1000000px;height:1000000px;left:0;top:0}.chartjs-size-monitor-shrink>div{position:absolute;width:200%;height:200%;left:0;top:0} |
|||
File diff suppressed because one or more lines are too long
Loading…
Reference in new issue