To add titles for the X and Y axes in a bar chart using Kendo UI with tag helpers, you can utilize the title
attribute for each axis.
Here's an example of how you can add titles for the X and Y axes in a bar chart using Kendo UI with tag helpers:
Tag Helpers@(Html.Kendo().Chart()
.Name("chart")
.Title("Bar Chart")
.Series(series =>
{
series.Bar(new int[] { 5, 10, 15, 7, 2 });
})
.CategoryAxis(axis => axis
.Title("X Axis Title")
)
.ValueAxis(axis => axis
.Title("Y Axis Title")
)
)
HTML Helpers$("#chart").kendoChart({
series: [{
type: "bar",
data: [5, 10, 15, 7, 2]
}],
categoryAxis: {
title: {
text: "X Axis Title"
}
},
valueAxis: {
title: {
text: "Y Axis Title"
}
}
});
In the code snippet above, we are using the Html.Kendo().Chart()
method to create a bar chart. The Name
method sets the name of the chart, and the Title
method sets the main title of the chart.
To add a title to the X axis, we use the CategoryAxis
method and the Title
attribute to set the desired title.
Similarly, for the Y axis, we use the ValueAxis
method and the Title
attribute to set the desired title.
You can replace "Bar Chart"
, "X Axis Title"
, and "Y Axis Title"
with your desired titles for the chart, X axis, and Y axis, respectively.
Comments
Post a Comment