TargetProcess / tauCharts

D3 based data-focused charting library. Designed with passion. Flexible.
https://www.taucharts.com
Other
1.91k stars 118 forks source link

Problem import plugin category-filter #537

Closed mauriciomanoel closed 6 years ago

mauriciomanoel commented 6 years ago

I'm import plugin tauCharts.api.plugins.get('category-filter')(), but console in my browser show me message:
[Show/hide message details.] Error: undefined plugin is not defined

mauriciomanoel commented 6 years ago

My code:

var chart = new tauCharts.Chart({ type: 'horizontal-stacked-bar', x: ['y1'], y: ['p'], color: 'x1',

  dimensions: {
      'p': {'type': 'category', 'scale': 'ordinal'},
      'x1': {'type': 'category', 'scale': 'ordinal', order: ['VDR']},
      'y1': {'type': 'measure', 'scale': 'linear'}
  },

  data: [
      {"p":"A", "x1": "TP3", "x2": "B0", "y1": 2231},
      {"p":"B", "x1": "TP3", "x2": "B1", "y1": 3231},
      {"p":"C", "x1": "TP3", "x2": "B2", "y1": 3231},
      {"p":"A", "x1": "TP3", "x2": "B3", "y1": -3231},
      {"p":"B", "x1": "TP3", "x2": "B4", "y1": 3231},
      {"p":"C", "x1": "TP3", "x2": "B5", "y1": 3231},

      {"p":"A", "x1": "VDR", "x2": "C1", "y1": 720},
      {"p":"B", "x1": "VDR", "x2": "C2", "y1": -1720},
      {"p":"C", "x1": "VDR", "x2": "C3", "y1": 2720},
      {"p":"A", "x1": "VDR", "x2": "C4", "y1": 1720},
      {"p":"B", "x1": "VDR", "x2": "C5", "y1": 3720},
      {"p":"C", "x1": "VDR", "x2": "C6", "y1": 5720},
      {"p":"A", "x1": "VDR", "x2": "C7", "y1": -5720},
      {"p":"B", "x1": "VDR", "x2": "C8", "y1": 5720},
      {"p":"C", "x1": "TP2", "x2": "C9", "y1": -4987},
      {"p":"A", "x1": "TP2", "x2": "C10", "y1": -4987}
  ].map(function (x, i) {
          // x.y1 = 'A' + String(i % 2);
          x.c = x.y1 >= 0;
          return x;
      }),
plugins: [
  tauCharts.api.plugins.get('tooltip')(),
  tauCharts.api.plugins.get('category-filter')(),
  tauCharts.api.plugins.get('quick-filter')()      
]

}); chart.renderTo('#scatter');

alexanderby commented 6 years ago

This plugin is available in Taucharts 2 only.