Chart Legend Property Not Working

1 Answer 31 Views
Chart
John
Top achievements
Rank 2
Iron
Iron
Iron
John asked on 30 Jan 2024, 01:43 PM

The chart legend property is not working at all for my chart using Razor syntax.  I'm using the latest version of Telerik.UI.for.AspNet.Core 2023.3.1114.

<chart-legend position="ChartLegendPosition.Top" visible="false" />

I'm trying to hide the legend and it still shows setting visible to false.  Also, the property position is not working.  No matter what I set it to the legend is on the bottom.

Here is the full code for the chart.

            <kendo-chart name="chartDeliveryOrder">
                <chart-area background="transparent"></chart-area>
                <category-axis>
                    <category-axis-item>
                        <labels font="16px 'Nunito Sans'" />
                        <major-grid-lines visible="false" />
                    </category-axis-item>
                </category-axis>
                <series>
                    <series-item type="ChartSeriesType.Column" category-field="DeliveryOrderNumber"
                                 field="SumTask1Through21Total" name="Tasks 1-21 Total" color="#1C355E" visible-in-legend="false" />
                </series>
                <value-axis>
                    <value-axis-item name="" type="numeric" min="0">
                        <labels format="C" font="16px 'Nunito Sans'" />
                        <line visible="false" />
                        <major-grid-lines visible="true" />
                    </value-axis-item>
                </value-axis>
                <datasource>
                    <transport>
                        <read type="post" url="@Url.Action("DeliveryOrderActualsSummaryChart", "Chart")" data="additionalInfo" />
                    </transport>
                </datasource>
                <chart-legend position="ChartLegendPosition.Top" visible="false" />
                <chart-title text="Delivery Order Summary" font="28px 'Nunito Sans, Bold'" />
                <tooltip visible="true" format="C" font="16px 'Nunito Sans'" />
            </kendo-chart>

1 Answer, 1 is accepted

Sort by
1
Accepted
Mihaela
Telerik team
answered on 02 Feb 2024, 11:56 AM

I have tested the Chart configuration in the attached runnable sample (Telerik UI for ASP.NET Core app, version 2023.3.1114), and it appears that the legend is hidden when the "visible" attribute is set to "false". Also, the legend is position correctly at my end.

  • <chart-legend position="ChartLegendPosition.Top" visible="false">

  • <chart-legend position="ChartLegendPosition.Top" visible="true" /> (the"visible-in-legend" attribute is enabled in the "series-item" tag)


With that said, would you modify the attached sample based on your setup to reproduce the issue you are experiencing and send it back in the thread to review it?

Thank you for your cooperation.

John
Top achievements
Rank 2
Iron
Iron
Iron
commented on 02 Feb 2024, 02:52 PM

Sorry, not it's not the legend but whatever you call the text under the bars.  Is there a way to hide it?  

 

 

Mihaela
Telerik team
commented on 05 Feb 2024, 12:12 PM

Indeed, you can hide the category labels through the <labels> child tag:

                <category-axis>
                    <category-axis-item>
                        <labels font="16px 'Nunito Sans'" visible="false"/>
                        <major-grid-lines visible="false" />
                    </category-axis-item>
                </category-axis>

Let me know if this is the result you aim to achieve.

Tags
Chart
Asked by
John
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Mihaela
Telerik team
Share this question
or