-
-
Save mathjazz/045858cce6479806c272c110be6ec8a2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function () { | |
| var script = document.getElementById('highcharts-script'); | |
| function addChart() { | |
| function parseData(completeHandler, chartOptions) { | |
| try { | |
| var dataOptions = { | |
| "seriesMapping": [ | |
| { | |
| "x": 0 | |
| } | |
| ], | |
| "columnTypes": [ | |
| "string", | |
| "float" | |
| ], | |
| "csv": "Idea,Votes\nNotifications,620\nPriorities and deadlines,613\nScreenshot-based l10n,607\nTerminology and Glossary,598\nMozilla.org in-context l10n,576\nMerging with dashboards,553\nTranslation comments,550\nMachine pre-translation,499\nDiff view over time,494\nResponsive mode,486\nProfiles as CVs,451" | |
| }; | |
| dataOptions.sort = true | |
| dataOptions.complete = completeHandler; | |
| Highcharts.data(dataOptions, chartOptions); | |
| } catch (error) { | |
| console.log(error); | |
| completeHandler(undefined); | |
| } | |
| } | |
| var shareUrl = 'http://cloud.highcharts.com/show/umeleho/0'; | |
| var encodedUrl = encodeURIComponent(shareUrl); | |
| var template = { | |
| chart: { | |
| renderTo: 'highcharts-umeleho' | |
| }, | |
| navigation: { | |
| menuItemStyle: { | |
| fontFamily: Highcharts.SVGRenderer.prototype.getStyle().fontFamily, | |
| padding: '2px 10px' | |
| } | |
| }, | |
| exporting: { | |
| buttons: { | |
| contextButton: { | |
| menuItems: [{ | |
| text: '<a href="https://www.facebook.com/sharer/sharer.php?u=' + encodedUrl + '" target="_blank">' + | |
| 'Share on Facebook</a>' | |
| }, { | |
| text: '<a href="https://plus.google.com/share?url=' + encodedUrl + '" target="_blank">' + | |
| 'Share on Google+</a>' | |
| }, { | |
| text: '<a href="https://twitter.com/share?url=' + encodedUrl + '&text=' + document.title + '" target="_blank">' + | |
| 'Share on Twitter</a>' | |
| }, { | |
| text: '<a href="http://www.linkedin.com/shareArticle?mini=true&url=' + encodedUrl + '" target="_blank">' + | |
| 'Share on LinkedIn</a>' | |
| }, { | |
| separator: true | |
| }] | |
| .concat(Highcharts.getOptions().exporting.buttons.contextButton.menuItems) | |
| .concat([{ | |
| separator: true | |
| }, { | |
| text: '<a href="' + shareUrl.replace('/show/', '/charts/') + '" target="_blank">' + 'Edit chart</a>' | |
| }, { | |
| text: '<a href="/charts" target="_blank">' + 'Create chart</a>' | |
| }]) | |
| } | |
| } | |
| } | |
| }; | |
| var chartOptions = { | |
| "plotOptions": { | |
| "series": { | |
| "dataLabels": { | |
| "enabled": true | |
| } | |
| } | |
| }, | |
| "yAxis": { | |
| "type": "logarithmic", | |
| "title": { | |
| "style": { | |
| "fontWeight": "normal" | |
| } | |
| } | |
| }, | |
| "credits": { | |
| "branded": true, | |
| "text": "Highcharts", | |
| "href": "//cloud.highcharts.com/", | |
| "enabled": true | |
| }, | |
| "legend": { | |
| "enabled": false | |
| }, | |
| "series": [ | |
| { | |
| "tooltip": { | |
| "valuePrefix": null | |
| }, | |
| "index": 0, | |
| "colorByPoint": true | |
| } | |
| ], | |
| "tooltip": { | |
| "enabled": false | |
| }, | |
| "title": { | |
| "text": "Pontoon Survey 2016" | |
| }, | |
| "chart": { | |
| "inverted": true, | |
| "type": "column" | |
| } | |
| }; | |
| parseData(function (dataOptions) { | |
| // Merge series configs | |
| if (chartOptions.series && dataOptions) { | |
| Highcharts.each(chartOptions.series, function (series, i) { | |
| chartOptions.series[i] = Highcharts.merge(series, dataOptions.series[i]); | |
| }); | |
| } | |
| var options = Highcharts.merge(dataOptions, chartOptions, template); | |
| var chart = new Highcharts['Chart'](options); | |
| }, chartOptions); | |
| } | |
| // Load the Highcharts script if undefined, and add the chart | |
| if (typeof Highcharts !== 'undefined') { | |
| addChart(); | |
| } else if (script) { | |
| script.deferredCharts.push(addChart); | |
| } else { | |
| script = document.createElement('script'); | |
| script.id = 'highcharts-script'; | |
| script.src = '//cloud.highcharts.com/resources/js/highstock-cloud-5.0.2.js'; | |
| script.type = 'text/javascript'; | |
| script.deferredCharts = [addChart]; | |
| script.onload = function () { | |
| // Prevent double firing of event in IE9/IE10 | |
| if (!script.chartsAdded) { | |
| script.chartsAdded = true; | |
| while(script.deferredCharts.length) { | |
| script.deferredCharts.shift()(); | |
| } | |
| } | |
| }; | |
| script.onreadystatechange = function() { | |
| if (this.readyState == 'complete' || this.readyState == 'loaded') { | |
| script.onload(); | |
| } | |
| }; | |
| document.getElementsByTagName('head')[0].appendChild(script); | |
| } | |
| }()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment