gpt4 book ai didi

Newbie Syncfusion Chart not showing bars(新手同步图表不显示条形图)

转载 作者:bug小助手 更新时间:2023-10-24 17:55:09 28 4
gpt4 key购买 nike



I am using Syncfusion charts for the first time. Their getting started instructions are very clear and I have my first chart on a Blazor component. The chart grid, titles, and x-axis displays fine, the y-axis is scaled properly..... however, no bars or lines show to display my data.

我是第一次使用SyncFusion图表。他们的入门说明非常清楚,我在Blazor组件上有了我的第一张图表。图表网格、标题和x轴显示良好,y轴缩放正确.....但是,没有显示条形或线条来显示我的数据。


Thanks for your help. Code is below.

谢谢你的帮助。代码如下。


    @using System.Runtime.CompilerServices
@using Syncfusion.Blazor
@using Syncfusion.Blazor.Charts
@implements IDisposable

<div style="position:absolute; text-align:center; top:0px; left:0px; width:100%; height:100%; font-size:1.2vh;">
<div style="height:60%;">
<SfChart Title="Messages Sent/Received">

<ChartPrimaryXAxis Title="Time Interval" ValueType="Syncfusion.Blazor.Charts.ValueType.Category"></ChartPrimaryXAxis>
@* <ChartPrimaryYAxis Title="Messages" ValueType="Syncfusion.Blazor.Charts.ValueType.Double"></ChartPrimaryYAxis>*@
<ChartTooltipSettings Enable="true"></ChartTooltipSettings>
<ChartSeriesCollection>
<ChartSeries DataSource="@SentMessages" XName="SeriesDate" YName="SeriesYValue" Type="ChartSeriesType.Line">
</ChartSeries>
</ChartSeriesCollection>

</SfChart>
</div>
</div>

@code {
public class SeriesType
{
public string SeriesDate { get; set; }
public double SeriesYValue { get; set; }
}
public List<SeriesType> SentMessages = new List<SeriesType>
{
new SeriesType {SeriesDate="8/1/2023", SeriesYValue=4023},
new SeriesType {SeriesDate="8/2/2023", SeriesYValue=2123},
new SeriesType {SeriesDate="8/3/2023", SeriesYValue=1823},
new SeriesType {SeriesDate="8/4/2023", SeriesYValue=2423},
new SeriesType {SeriesDate="8/5/2023", SeriesYValue=923}
};

更多回答
优秀答案推荐

Query: "The chart is not showing lines." for this query the issue may occur due to incorrect script references. As a suggestion you can check whether the script is properly referenced in the _Host.cshtml file for Blazor Server or index.html for Blazor Web Assembly. It is important to ensure that the script is referenced correctly to avoid any rendering issues. A sample and screenshot is attached for your reference. Please review the following code snippet:

查询:“图表没有显示线条。”对于此查询,该问题可能是由于不正确的脚本引用造成的。作为建议,您可以检查是否在Blazor服务器的_Host.cshtml文件或Blazor Web Assembly的index.html文件中正确引用了该脚本。确保正确引用脚本以避免任何呈现问题,这一点很重要。附上一个样本和截图供您参考。请查看以下代码片段:


For Individual package script reference:

对于单个程序包脚本参考:


<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js" type="text/javascript"></script>

For whole package script reference:

对于整个程序包脚本参考:


<script src="_content/Syncfusion.Blazor/scripts/syncfusion-blazor.min.js" type="text/javascript"></script>

For CDN script reference:

CDN脚本参考:


<script src=https://cdn.syncfusion.com/blazor/22.1.38/syncfusion-blazor.min.js type="text/javascript"></script>

Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/SyncfusionChart-834673013.zip

示例:https://www.syncfusion.com/downloads/support/directtrac/general/ze/SyncfusionChart-834673013.zip


Screenshot:
enter image description here

屏幕截图:在此处输入图片说明


UG for Getting Started: https://blazor.syncfusion.com/documentation/chart/getting-started

入门指南:https://blazor.syncfusion.com/documentation/chart/getting-started


UG for Script references: https://blazor.syncfusion.com/documentation/common/adding-script-references

脚本引用的UG:https://blazor.syncfusion.com/documentation/common/adding-script-references


Regards,

向您致敬,


Gopalakrishnan Veeraraghavan


更多回答

Perfect! Worked like a charm.

太棒了!就像一个护身符。

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com