C# 控制剑道UI圆环图的大小
我很难控制剑道UI()中甜甜圈组件的大小。 这是我的密码:C# 控制剑道UI圆环图的大小,c#,razor,kendo-ui,C#,Razor,Kendo Ui,我很难控制剑道UI()中甜甜圈组件的大小。 这是我的密码: <div class="analytic-block"> <h4>Sources</h4> <span class="text-muted">Recent activity</span> @(Html.Kendo() .Chart<ActivityModel>() .Name("don
<div class="analytic-block">
<h4>Sources</h4>
<span class="text-muted">Recent activity</span>
@(Html.Kendo()
.Chart<ActivityModel>()
.Name("donutChart")
.Legend(legend => legend.Position(ChartLegendPosition.Bottom))
.DataSource(ds => ds
.Read(read => read.Action("Sources", "Statistics"))
.Group(group => group.Add(item => item.SliceLayer))
.Sort(sort => sort.Add(item => Guid.NewGuid().ToString())))
.Series(series =>
{
series.Donut(model => model.Share, model => model.Label, model => model.Color, model => true, mode => true)
.Border(b =>
{
b.Color("white");
b.Width(2);
})
.StartAngle(0)
.Labels(labels => labels.Visible(true)
.Position(ChartPieLabelsPosition.OutsideEnd)
.Template(" #=dataItem.Label #")//.Template("<span style=\"color:#=dataItem.Color#;\"> #=dataItem.Label # </span>")
.Background("transparent")
.Border(1, "grey", ChartDashType.Solid)
.Padding(2))
.Padding(120);
})
.Tooltip(tooltip => tooltip
.Template(" #=dataItem.Label # ")
.Visible(true)))
</div>
来源
近期活动
@(Html.Kendo()
.Chart()
.名称(“donutChart”)
.Legend(Legend=>Legend.Position(ChartLegendPosition.Bottom))
.DataSource(ds=>ds
.Read(Read=>Read.Action(“源”、“统计”))
.Group(Group=>Group.Add(item=>item.SliceLayer))
.Sort(Sort=>Sort.Add(item=>Guid.NewGuid().ToString()))
.系列(系列=>
{
series.Donut(model=>model.Share,model=>model.Label,model=>model.Color,model=>true,mode=>true)
.Border(b=>
{
b、 颜色(“白色”);
b、 宽度(2);
})
.StartAngle(0)
.Labels(Labels=>Labels.Visible(true)
.位置(图表标签位置.外侧端)
.Template(“#=dataItem.Label#”)/.Template(“#=dataItem.Label#”)
.背景(“透明”)
.边框(1,“灰色”,ChartDashType.Solid)
(二)
.填充(120);
})
.工具提示(工具提示=>工具提示
.Template(“#=dataItem.Label#”)
.可见(真实)))
这是它产生的结果:
我可以通过更改.Padding(120)来调整图表的大小,但这会在图表的上方和下方留下两个较大的空间。我找不到任何关于如何操作绘制此图表的区域大小的参考
如果有人能提出解决方案,我们将不胜感激。您只需将转换为图表的div chart元素设置为宽度/高度即可
就是一个例子。我发现了我的错误。div容器必须与图表ID相关:
<div id="donutChart" class="analytic-block">
@(Html.Kendo()
.Chart<ActivityModel>()
.Name("donutChart")
</div>
@(Html.Kendo()
.Chart()
.名称(“donutChart”)
谢谢。问题是我没有将包含的div ID与图表的ID联系起来。您的回答促使我找到了正确的答案。