Change Default Chart Font

1 Answer 34 Views
Chart
Tim
Top achievements
Rank 3
Iron
Iron
Iron
Tim asked on 04 Jan 2024, 04:09 PM | edited on 05 Jan 2024, 01:39 PM

I have a column chart that has a default font of Arial. Is it possible to change this to the Inter font in one place or does the font have to be set for each individual label (e.g. chart title, axis title, axis label, legend, tooltip, etc.)?

Thanks,

Tim

1 Answer, 1 is accepted

Sort by
1
Alexander
Telerik team
answered on 09 Jan 2024, 09:27 AM

Hi Tim,

At this stage, there is no autonomous configuration for adding a default Font that will be employed for each of the mentioned label compartments.

However, I do personally agree with you that such an enhancement could be potentially beneficial. In this regard, I have logged a feature request on your behalf primarily within the realm of Kendo UI for jQuery, since the Telerik UI for ASP.NET Core components can be perceived as wrappers for the jQuery widgets:

In order to spare you some time, I have added a vote on your behalf. Generally, the requests are triaged based on several factors such as: community demand, severity, and time costs.

For the time being, my personal recommendation would be to set the labels via their respective Title.Font()Tooltip.Font(), AxisDefaults.Labels.Font() and Legend.Labels.Font() API configuration.

"Notice, that the configurations accept all of the font properties."

Here is the CSS syntax for the font properties:

font: font-style font-variant font-weight font-size/line-height font-family|caption|icon|menu|message-box|small-caption|status-bar|initial|inherit;

Here is a Telerik REPL example in which the aforementioned API configurational methods are utilized:

The configurations in the example are declared in the following manner:

@(Html.Kendo().Chart()
    .Name("chart")
    .Title(t => t.Text("Sales Totals").Color("#111111")
        .Font("20px Inter, sans-serif")
    )
    .Legend(legend => legend
        ...
        .Labels(labels => labels.Font("20px Inter, sans-serif"))
    )
    .AxisDefaults(defaults => defaults
			.Labels(labels => labels.Font("15px Inter, sans-serif")
		)
	)
    ...
    .Tooltip(tooltip => tooltip
        .Font("15px Inter, sans-serif")
	...
    )
)

For further bringing this to our attention, I have also updated your Telerik points as a token of appreciation.

I hope this helps.

Kind Regards,
Alexander
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages. If you're new to the Telerik family, be sure to check out our getting started resources, as well as the only REPL playground for creating, saving, running, and sharing server-side code.
Tim
Top achievements
Rank 3
Iron
Iron
Iron
commented on 09 Jan 2024, 02:14 PM

Thank you!
Tags
Chart
Asked by
Tim
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Alexander
Telerik team
Share this question
or