123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- "use strict";
- // Class definition
-
- var graph = function () {
- // Private functions
-
- // basic demo
- var graphic = function (config) {
- Highcharts.chart(config.id, {
- chart: {
- type: config.type,
- text: '',
- },
- title: {
- text: config.title
- },
- xAxis: {
- categories: config.xcategories
- },
- yAxis: {
- title: {
- text: config.ytitle
- }
- },
- legend: {
- enabled: false
- },
-
- plotOptions: {
- series: {
- label: {
- connectorAllowed: true
- }
-
- }
- },
- series: config.series,
- tooltip: {
- formatter: function () {
- return '<b>' + this.series.name + '</b><br/>' +
- this.point.y + ' ';
- }
- },
- });
- };
-
- var graphic_modal = function (config) {
- Highcharts.chart(config.id, {
- chart: {
- type: config.type,
- text: '',
- },
- title: {
- text: config.title
- },
- xAxis: {
- categories: config.xcategories
- },
- yAxis: {
- title: {
- text: config.ytitle
- }
- },
- legend: {
- enabled: false
- },
-
- plotOptions: {
- series: {
- label: {
- connectorAllowed: true,
- },
- point: {
- events: {
- click: function () {
- // alert('Category: ' + this.category + ', value: ' + this.y);
- // var class_modal = '' + config.class_modal + ''
- $(config.class_modal).click();
- var param = this.category;
- var urlnya = config.url_modal;
- $.ajax({
- type: "POST",
- url: urlnya,
- data: {
- param: param
- },
- success: function (response) {
- // console.log(response);
- $(".modal-content").html(response.html);
- }
- });
- }
- }
- }
-
- }
- },
- series: config.series,
- tooltip: {
- formatter: function () {
- return '<b>' + this.series.name + '</b><br/>' +
- this.point.y + ' ';
- }
- },
- });
- };
-
- return {
- // public functions
- init_graph: function (config) {
- graphic(config);
- },
- init_graph_modal: function (config) {
- graphic_modal(config);
- }
- };
- }();
|