You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ASP.NET Core中Syncfusion环形图标题下移与中心标签显示问题求助

问题解决:Syncfusion EJ2 环形图标题位置与中心标签显示问题

1. 将环形图标题移动到底部

Syncfusion AccumulationChart 的标题默认显示在顶部,只需在图表标签中添加 titlePosition="Bottom" 属性即可将标题移至底部,同时可通过 titlestyle 调整标题样式:

<ejs-accumulationchart id="chart_@platform" title="@platform" height="380" width="280" titlePosition="Bottom">
    <!-- 其他配置项 -->
    <e-accumulationchart-titlestyle font-weight="600" size="16"></e-accumulationchart-titlestyle>
</ejs-accumulationchart>

2. 修复循环生成的环形图中心标签不显示问题

针对循环生成的五个环形图中心标签无法显示(单个图表正常)的情况,可从以下几点调整:

显式声明中心标签可见性并优化样式

给 <e-accumulationchart-centerlabel> 添加 visible="true" 显式开启,同时配置字体样式避免被遮挡:

<e-accumulationchart-centerlabel text="NAME<br>OF<br>PLATFORM" visible="true">
    <e-centerlabel-font size="18" fontWeight="600" color="#333"></e-centerlabel-font>
</e-accumulationchart-centerlabel>

调整图表边距,避免布局挤压

当前设置的 margin 为全0,可能导致标题(移至底部后)与中心标签重叠,或中心标签无足够空间展示,调整边距留出缓冲:

<e-accumulationchart-margin left="10" right="10" top="10" bottom="20"></e-accumulationchart-margin>

优化外层容器布局

给每个图表的外层div添加类名,避免布局冲突:

<div class="chart-container">
    <!-- 环形图代码 -->
</div>

对应的CSS样式:

.chart-container {
    margin: 0 10px;
    display: inline-block;
}

完整修改后的循环内图表代码

<div class="chart-container">
    <ejs-accumulationchart id="chart_@platform" title="@platform" height="380" width="280" titlePosition="Bottom">
        <e-accumulationchart-margin left="10" right="10" top="10" bottom="20"></e-accumulationchart-margin>
        <e-accumulationchart-centerlabel text="NAME<br>OF<br>PLATFORM" visible="true">
            <e-centerlabel-font size="18" fontWeight="600" color="#333"></e-centerlabel-font>
        </e-accumulationchart-centerlabel>
        <e-accumulationchart-legendsettings visible="false"></e-accumulationchart-legendsettings>
        <e-accumulationchart-tooltipsettings enable="false"></e-accumulationchart-tooltipsettings>
        <e-accumulationchart-titlestyle font-weight="600" size="16"></e-accumulationchart-titlestyle>
        <e-accumulation-series-collection>
            <e-accumulation-series dataSource="ViewBag.dataSource_platform" xName="xValue" yName="yValue" radius="95%" innerRadius="45%" name="Project" explode=true explodeOffset="10%" explodeIndex=3 >
                <e-accumulationseries-datalabel visible="true" name="text">
                    <e-font fontWeight="600" Size="20" color="white"></e-font>
                </e-accumulationseries-datalabel>
            </e-accumulation-series>
        </e-accumulation-series-collection>
    </ejs-accumulationchart>
</div>

内容的提问来源于stack exchange,提问作者nyny

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 06:10:26