问题描述
我使用Serenity框架创建了一个应用程序。我已经完成了使用宁静的CRUD的基本功能。根据我的表格,我需要有图形表示,任何图表如高图表,D3图表或任何图表。
1.如何使用宁静框架从表格中获取数据?
2.如何将数据自定义为图形表示?
I have created an application using Serenity framework. I have completed basic functionality for CRUD using serenity. Based on my tables I need to have graphical representations, any charts like high charts, D3 charts or any . 1. How can I get data from the tables using serenity framework ?2. How can I customise the data into graphical representations ?
推荐答案
最后我找到了答案。我们可以使用sql查询以及存储过程从数据库中获取数据。我已经使用存储过程从数据库中获取数据。
Finally I have found the answer for this. We can use sql queries as well as stored procedure to fetch data from DB. I have used stored procedure to get the data from db.
在存储库页面中,您可以调用存储过程,
In repository page you can call stored procedure,
public ListResponse<MyRow> GetCustomData(IDbConnection connection)
{
var data = connection.Query<MyRow>("GetOrders",
param: new
{
startDate = request.nstartDate,
endDate = request.EndDate
},
commandType: System.Data.CommandType.StoredProcedure);
var response = new ListResponse<MyRow>();
response.Entities = (List<MyRow>)data;
return response;
}
我已经定义了MyRow作为 OrderRow 这样的
使用MyRow = Entities.OrderRow;
I have already defined MyRow as OrderRow like thisusing MyRow = Entities.OrderRow;.
您可以调用此方法从你的控制器。您可以将该值传递给模型,并可以使用chart lik highcharts或d3图表的数据。
You can call this method from your controller. You can pass the value to model and can use data for chart lik highcharts or d3 charts.
希望这可以帮到您。
这篇关于如何在Serenity管理仪表板中添加新图表(任何图表,高图或D3图表)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!