2017-12-13 6 views
4

添付のスクリーンショットに示されているように、自分のチャートを作成する必要があります。 私はこの目的でHighChartsを使用していますが、適切なオプションや設定を見つけることができませんでした。私も、私はこれらの設計要件を達成するために使用私の現在の実装へのフィドルのリンクを添付しています株価チャートタイムラインボタンと日付フィールドはチャートと左揃え

enter image description here

:私の必要な設計のスクリーンショットを以下に示します。

My Fiddle

HTML:

<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script> 
<script src="https://code.highcharts.com/stock/highstock.js"></script> 
<script src="https://code.highcharts.com/stock/modules/exporting.js"></script> 
<div id="container" style="height: 400px; min-width: 310px"></div> 

はJavaScript:

Highcharts.stockChart('container', { 
    chart: { 
    spacingLeft: 200, 
    }, 
    navigator: { 
    enabled: false 
    }, 
    scrollbar: { 
    enabled: false 
    }, 
    title : { 
    text : 'Activity' 
    }, 
    rangeSelector: { 
    allButtonsEnabled: true, 
    buttons: [{ 
     type: 'month', 
     count: 3, 
     text: 'Daily', 
     dataGrouping: { 
     forced: true, 
     units: [['day', [1]]] 
     } 
    }, { 
     type: 'year', 
     count: 1, 
     text: 'Weekly', 
     dataGrouping: { 
     forced: true, 
     units: [['week', [1]]] 
     } 
    }, { 
     type: 'all', 
     text: 'Monthly', 
     dataGrouping: { 
     forced: true, 
     units: [['month', [1]]] 
     } 
    }], 
    buttonTheme: { 
     width: 60 
    }, 
    selected: 2 
    }, 
    legend: { 
    enable: true, 
    align: 'left', 
    verticalAlign: 'top', 
    layout: 'vertical', 
    x: 0, 
    y: 100 
    }, 
    xAxis: { 
    type: 'datetime', 
    dateTimeLabelFormats: { 
     month: '%e. %b', 
     year: '%b' 
    } 
    }, 
    series: [{ 
    name: 'Label 1', 
    color: "#00aade", 
    data: [[1501545600000, 5], [1504224000000,4], [1506816000000, 6],[1509494400000,5]] 
    }, 
    { 
    name: 'Label 2', 
    color: "#8cc63e", 
    data: [[1501545600000, 1], [1504224000000,0], [1506816000000, 2],[1509494400000,0]] 
    }] 
}); 

親切にいくつかのいずれかが、これを達成するために、適切な構成やスタイリングを行う際に私を導くことができるかどうか。

ありがとうございました。

答えて

1

これは私が

http://jsfiddle.net/0yax1bav/5/

取得左側に間隔を追加することができます最も近いです左:

title : { 
    align: 'left', 
    x: -280, 
    text : 'Activity', 
    floating: true 
}, 

移動範囲:

rangeSelector: { 
    floating: true, 
    x: 0, 
    verticalAlign: 'middle', 
    buttonPosition: { 
     align: 'left', 
     y: 20, 
     x: -140 
    }, 
    inputPosition: { 
     align: 'left', 
     y: 15, 
     x: -280 
    }, 
    ... 

無効エクスポートボタン:

exporting:{ 
    buttons:{ 
     contextButton: { 
      enabled: false 
     } 
    } 
} 

Highcharts.stockChart('container', { 
    chart: { 
    spacingLeft: 300, 
    }, 
    legend: { 
     enabled: true, 
     align: 'left', 
     verticalAlign: 'top', 
     layout: 'vertical', 
     x: -250, 
     y: 150 
    }, 
    navigator: { 
    enabled: false 
    }, 
    scrollbar: { 
    enabled: false 
    }, 
    exporting:{ 
    buttons:{ 
     contextButton: { 
      enabled: false 
     } 
    } 
    }, 
    title : { 
    align: 'left', 
    x: -280, 
    text : 'Activity', 
    floating: true 
    }, 
    rangeSelector: { 
    floating: true, 
    x: 0, 
    verticalAlign: 'middle', 
    buttonPosition: { 
      align: 'left', 
      y: 20, 
      x: -140 
     }, 
    inputPosition: { 
      align: 'left', 
      y: 15, 
      x: -280 
    }, 
    allButtonsEnabled: true, 
    buttons: [{ 
     type: 'month', 
     count: 3, 
     text: 'Daily', 
     dataGrouping: { 
     forced: true, 
     units: [['day', [1]]] 
     } 
    }, { 
     type: 'year', 
     count: 1, 
     text: 'Weekly', 
     dataGrouping: { 
     forced: true, 
     units: [['week', [1]]] 
     } 
    }, { 
     type: 'all', 
     text: 'Monthly', 
     dataGrouping: { 
     forced: true, 
     units: [['month', [1]]] 
     } 
    }], 
    buttonTheme: { 
     width: 60 
    }, 
    selected: 2 
    }, 
    xAxis: { 
    type: 'datetime', 
    dateTimeLabelFormats: { 
     month: '%e. %b', 
     year: '%b' 
    } 
    }, 
    series: [{ 
    name: 'Label 1', 
    color: "#00aade", 
    data: [[1501545600000, 5], [1504224000000,4], [1506816000000, 6],[1509494400000,5]] 
    }, 
    { 
    name: 'Label 2', 
    color: "#8cc63e", 
    data: [[1501545600000, 1], [1504224000000,0], [1506816000000, 2],[1509494400000,0]] 
    }] 
}); 
1

私はthis far. Highcharts xを得ることができた、y座標を使用するように挑戦ビットですが、あなたはbuttonPositionにもう少しスタイリングを行うために必要な、inputPosition、およびTitle(see screenshot)右側に移動します

HTML:

<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script> 
<script src="https://code.highcharts.com/stock/highstock.js"></script> 
<script src="https://code.highcharts.com/stock/modules/exporting.js"> 
</script> 
<div id="container" style="height: 400px; min-width: 310px"></div> 

はJavaScript:

Highcharts.stockChart('container', { 
    chart: { 
    marginLeft: 300, 
    }, 
    navigator: { 
    enabled: false 
    }, 
    scrollbar: { 
    enabled: false 
    }, 
    title : { 
    text : 'Activity', 
    x: -280 
    }, 
    rangeSelector: { 
    x: 0, 
    verticalAlign: 'middle', 
    buttonPosition: { 
      align: 'left', 
      y: 20, 
      x: -140 
     }, 
    inputPosition: { 
      align: 'left', 
      y: 15, 
      x: -280 
    }, 
    allButtonsEnabled: true, 
    buttons: [{ 
     type: 'month', 
     count: 3, 
     text: 'Daily', 
     dataGrouping: { 
     forced: true, 
     units: [['day', [1]]] 
     } 
    }, { 
     type: 'year', 
     count: 1, 
     text: 'Weekly', 
     dataGrouping: { 
     forced: true, 
     units: [['week', [1]]] 
     } 
    }, { 
     type: 'all', 
     text: 'Monthly', 
     dataGrouping: { 
     forced: true, 
     units: [['month', [1]]] 
     } 
    }], 
    buttonTheme: { 
     width: 60 
    }, 
    selected: 2 
    }, 


    legend: { 
     width: 100, 
     align: 'left', 
     x: 0, // = marginLeft - default spacingLeft 
     y: -100, 
     itemWidth: 100, 
     borderWidth: 1 
    }, 
    xAxis: { 
    type: 'datetime', 
    dateTimeLabelFormats: { 
     month: '%e. %b', 
     year: '%b' 
    } 
    }, 
    series: [{ 
    name: 'Label 1', 
    color: "#00aade", 
    data: [[1501545600000, 5], [1504224000000,4], [1506816000000, 6],[1509494400000,5]] 
    }, 
    { 
    name: 'Label 2', 
    color: "#8cc63e", 
    data: [[1501545600000, 1], [1504224000000,0], [1506816000000, 2],[1509494400000,0]] 
    }] 
}); 

凡例がレンダリングされていない - データが正しい形式であることを確認し、xyで再生してみてください。へ

legend: { 
    enabled: true, 
    align: 'left', 
    verticalAlign: 'top', 
    layout: 'vertical', 
    x: -250, 
    y: 150 
}, 

移動タイトル:左に

chart: { 
    spacingLeft: 300, 
}, 

移動伝説:

関連する問題