我正在嘗試更改谷歌條形圖上所有內容的字體。它適用於除了工具提示之外的所有內容。至少,我認爲它被稱爲工具提示 - 它是您將鼠標懸停在欄上時顯示的字體。我覺得我在做它正確根據文檔:更改谷歌條形圖上的字體
<!doctype html>
<html>
<head>
<style>
@font-face {
font-family: bebas;
src: url(BebasNeue.otf);
}
</style>
</head>
<body>
<h1 style="font-family:bebas;">This font changed</h1>
<script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1.1','packages':['bar']}]}"></script>
<div id="cheese_plot" style="width: 900px; height: 500px; font-family:bebas;"></div>
<script type="text/javascript">
google.setOnLoadCallback(drawStuff);
var rawdata = [["Swiss", 90],
["Cheddah", 75],
["'Merican", 35],
["Le bleu", 65],
['Stinky', 70]];
var labels = [['Cheese', 'Pieces']];
var fullArray = labels.concat(rawdata);
function drawStuff() {
var data = new google.visualization.arrayToDataTable(
fullArray
);
var options = {
annotations: {textStyle: { fontName: 'bebas' }},
hAxis: {textStyle: { fontName: 'bebas' }, titleTextStyle: { fontName: 'bebas' }},
vAxis: {textStyle: { fontName: 'bebas' }, titleTextStyle: { fontName: 'bebas' }},
titleTextStyle: { fontName: 'bebas' },
tooltip: {textStyle: {fontName: 'bebas' }},
fontName: 'bebas',
fontSize: 24,
title: 'Cheeseses',
width: 900,
legend: { position: 'none' },
chart: { title: 'Cheese',
subtitle: 'pieces' },
bars: 'horizontal',
axes: {
x: {0: { side: 'top', label: 'Pieces'}}},
bar: { groupWidth: "90%" }
};
var chart = new google.charts.Bar(document.getElementById('cheese_plot'));
chart.draw(data, google.charts.Bar.convertOptions(options));
};
</script>
</body>
</html>
下面是文檔:https://developers.google.com/chart/interactive/docs/gallery/barchart?hl=it#data-format
我試圖使用自定義字體我從這裏得到:http://www.dafont.com/bebas-neue.font
這是谷歌圖表錯誤,我做錯了什麼;這甚至有可能嗎?
這不是很有幫助,但你拼寫'芝士'。 – doublesharp
這是故意的。 – wordsforthewise
Then nevermind :) – doublesharp