2

ご覧のとおり、font-family を設定しようとしましたが、ドキュメントに記載されているすべての方法で試しました: http://code.google.com/apis/chart/interactive/docs/gallery/piechart.html

しかし、ie7-8 (vml バージョン) では、間違ったフォントが表示されます。Google の問題ではなく vml の問題である可能性がありますが、私には考えがありません。ありがとう!

    // Load the Visualization API and the piechart package.
    google.load('visualization', '1.0', {'packages':['corechart']});

    // Set a callback to run when the Google Visualization API is loaded.
    google.setOnLoadCallback(drawChart);

    // Callback that creates and populates a data table, 
    // instantiates the pie chart, passes in the data and
    // draws it.
    function drawChart() {

    // Create the data table.
    var data = new google.visualization.DataTable();
    data.addColumn('string', 'Vote');
    data.addColumn('number', 'Votes');
    data.addRows([
    ['BLAH', blah],
    ['AHH', ahh]
    ]);

    // Set chart options
    var options = {
        is3D:false,
        width:200,
        height:200,
        fontSize: '14px',
        fontName: 'Arial',
        colors: ['#bcbdc0', '#FFF'],
        legend: 'none',
        pieSliceText: 'label',
        backgroundColor: '#f8f6e8'  ,
        pieSliceBorderColor: 'black',
        pieSliceTextStyle: {
            color: 'black', fontName: 'Arial', fontSize:'14'
        }

    };

    // Instantiate and draw our chart, passing in some options.
    var chart = new google.visualization.PieChart(document.getElementById('chart-div-'+id));
    chart.draw(data, options);
    }
4

1 に答える 1

9

次のように変更してみてください:

fontName: '"Arial"'

つまり、一重引用符の中に二重引用符を追加します。それは私にとってはうまくいきました(ただし、使用されているフォントがArial Boldであるため、まだ醜く見えますが、すべての要素のサイズは標準のArialを使用して設定されているようで、すべての単語の末尾にピクセルがありません)

于 2012-03-01T12:50:38.203 に答える