marklogic-community / slush-marklogic-node

Slush generator for a MarkLogic/node project
https://github.com/marklogic-community/slush-marklogic-node/wiki
Other
40 stars 28 forks source link

Improve chart features #545

Open grtjn opened 6 years ago

grtjn commented 6 years ago

Move code from landing control to charts service, and allow callback:

-    service.top10Chart = function(title, type, xFacet, xLabel, limit) {
+    service.top10Chart = function(title, type, xFacet, xLabel, limit, callback) {
       return {
         options: {
           chart: {
@@ -30,6 +30,21 @@
           },
           legend: {
             enabled: false
+          },
+          plotOptions: {
+            series: {
+              cursor: 'pointer',
+              point: {
+                events: {
+                  click: function (e) {
+                    var facet = this.series.name;
+                    var x = this.xCategory || this.x;
+                    var y = this.yCategory || this.y;
+                    callback(facet, x, y);
+                  }
+                }
+              }
+            }
janmichaelyu commented 6 years ago

@grtjn Please assign to me. I think there are some improvements to be made as well as charts have multiple calls and are slow for big datasets.

grtjn commented 6 years ago

There should be one call per chart. It could potentially reuse facets from search, but the landing page is not showing search results, and facets wouldn't support co-occurrence charts.

But please, do go ahead. Consider this ticket yours (cannot assign it)..

janmichaelyu commented 6 years ago

Pull request that fixes the multiple calls:

https://github.com/ryanjdew/ml-highcharts-ng/pull/33

janmichaelyu commented 6 years ago

Pull request that moves the chart functions to a separate service: https://github.com/marklogic-community/slush-marklogic-node/pull/552