summaryrefslogtreecommitdiffstats
path: root/tools/infra-dashboard/js/test_graph.js
diff options
context:
space:
mode:
authorjose.lausuch <jose.lausuch@ericsson.com>2016-06-01 23:00:08 +0200
committerjose.lausuch <jose.lausuch@ericsson.com>2016-06-02 20:12:49 +0200
commitaf427a992a96519c00ac9f98db8745f9fc1198fb (patch)
tree36f69164b289ce2405419f3946b7af0ba8f8b08e /tools/infra-dashboard/js/test_graph.js
parent43b44d05ed662d7e9e4f0a66b5f1744685d7b5cc (diff)
OPNFV Infra Dashboard
JIRA: RELENG-12 Change-Id: I7451a3d234e4e5d946cdb905d5720be6159b6544 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'tools/infra-dashboard/js/test_graph.js')
-rw-r--r--tools/infra-dashboard/js/test_graph.js108
1 files changed, 108 insertions, 0 deletions
diff --git a/tools/infra-dashboard/js/test_graph.js b/tools/infra-dashboard/js/test_graph.js
new file mode 100644
index 00000000..1d1d5e43
--- /dev/null
+++ b/tools/infra-dashboard/js/test_graph.js
@@ -0,0 +1,108 @@
+$(function () {
+
+ // Get the CSV and create the chart
+ $.getJSON('https://www.highcharts.com/samples/data/jsonp.php?filename=analytics.csv&callback=?', function (csv) {
+
+ $('#container').highcharts({
+
+ data: {
+ csv: csv
+ },
+
+ title: {
+ text: 'Daily visits at www.highcharts.com'
+ },
+
+ subtitle: {
+ text: 'Source: Google Analytics'
+ },
+
+ xAxis: {
+ tickInterval: 7 * 24 * 3600 * 1000, // one week
+ tickWidth: 0,
+ gridLineWidth: 1,
+ labels: {
+ align: 'left',
+ x: 3,
+ y: -3
+ }
+ },
+
+ yAxis: [{ // left y axis
+ title: {
+ text: null
+ },
+ labels: {
+ align: 'left',
+ x: 3,
+ y: 16,
+ format: '{value:.,0f}'
+ },
+ showFirstLabel: false
+ }, { // right y axis
+ linkedTo: 0,
+ gridLineWidth: 0,
+ opposite: true,
+ title: {
+ text: null
+ },
+ labels: {
+ align: 'right',
+ x: -3,
+ y: 16,
+ format: '{value:.,0f}'
+ },
+ showFirstLabel: false
+ }],
+
+ legend: {
+ align: 'left',
+ verticalAlign: 'top',
+ y: 20,
+ floating: true,
+ borderWidth: 0
+ },
+
+ tooltip: {
+ shared: true,
+ crosshairs: true
+ },
+
+ plotOptions: {
+ series: {
+ cursor: 'pointer',
+ point: {
+ events: {
+ click: function (e) {
+ hs.htmlExpand(null, {
+ pageOrigin: {
+ x: e.pageX || e.clientX,
+ y: e.pageY || e.clientY
+ },
+ headingText: this.series.name,
+ maincontentText: Highcharts.dateFormat('%A, %b %e, %Y', this.x) + ':<br/> ' +
+ this.y + ' visits',
+ width: 200
+ });
+ }
+ }
+ },
+ marker: {
+ lineWidth: 1
+ }
+ }
+ },
+
+ series: [{
+ name: 'All visits',
+ lineWidth: 4,
+ marker: {
+ radius: 4
+ }
+ }, {
+ name: 'New visitors'
+ }]
+ });
+ });
+
+});