0

115 ほどのシリーズがプロットされた dygraphs チャートがあります。それはうまくいきます。ただし、強調表示されたシリーズのシリーズ名を取得する方法と、その番号をフォーマットする方法を理解しようとしています。

dygraph フィドル ページの例 (ただし、データには大きな php 文字列を使用しますが、これは表示されません)。http://jsfiddle.net/eM2Mg/861/

「Year: 1955 Y73 Portfolio: $1,000,000」のような強調表示されたラベルになります。その 73 番号を取得して、その内容を編集できるようにしたいと考えています。dygraph js ファイルで、シリーズ番号の特定のラベル フォーマッタ、またはそれを取得する方法が見つかりません。すべてのシリーズに手動でラベルを付ける必要はありません。

アイデア?これは素晴らしいグラフ作成ソフトウェアです。

gr = new Dygraph(
// containing div
document.getElementById("graphdiv2"),
// CSV or path to a CSV file.
<?php echo $chartDataString2; ?>,
{
    title: 'Spending Level',
    ylabel: 'Spending ($)',
    xlabel: 'Year',
    labelsDivStyles: { 'textAlign': 'right' },
    digitsAfterDecimal: 0,
    yAxisLabelWidth: 100,
    axes: {
        y: {


                labelsKMB: false,
                maxNumberWidth: 11,
                valueFormatter: function numberWithCommas(x) {
                    return 'Spending: $' + x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                },
                axisLabelFormatter: function numberWithCommas(x) {
                    return '$' + x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
                }
        },
        x: {
            valueFormatter: function numberWithCommas(x) {
                    return 'Year: ' + x;
                },
        },
    },
    showLabelsOnHighlight: true,
    highlightCircleSize: 3,
    strokeWidth: 1.5,
    strokeBorderWidth: 0,
 highlightSeriesBackgroundAlpha: 1.0,
    highlightSeriesOpts: {
      strokeWidth: 4,
      strokeBorderWidth: 2,
      highlightCircleSize: 5,
    },
}
);
4

1 に答える 1