});
});
- it('should update elements when the scales are stacked and the y axis is logarithmic', function() {
- var chart = window.acquireChart({
- type: 'bar',
- data: {
- datasets: [{
- data: [10, 100, 10, 100],
- label: 'dataset1'
- }, {
- data: [100, 10, 0, 100],
- label: 'dataset2'
- }],
- labels: ['label1', 'label2', 'label3', 'label4']
- },
- options: {
- legend: false,
- title: false,
- datasets: {
- bar: {
- barPercentage: 1,
- }
- },
- scales: {
- x: {
- type: 'category',
- display: false,
- stacked: true,
- },
- y: {
- type: 'logarithmic',
- display: false,
- stacked: true
- }
- }
- }
- });
-
- var meta0 = chart.getDatasetMeta(0);
-
- [
- {b: 512, w: 102, x: 64, y: 512},
- {b: 512, w: 102, x: 192, y: 118},
- {b: 512, w: 102, x: 320, y: 512},
- {b: 512, w: 102, x: 449, y: 118}
- ].forEach(function(values, i) {
- expect(meta0.data[i]._model.base).toBeCloseToPixel(values.b);
- expect(meta0.data[i]._model.width).toBeCloseToPixel(values.w);
- expect(meta0.data[i]._model.x).toBeCloseToPixel(values.x);
- expect(meta0.data[i]._model.y).toBeCloseToPixel(values.y);
- });
-
- var meta1 = chart.getDatasetMeta(1);
-
- [
- {b: 512, w: 102, x: 64, y: 102},
- {b: 118, w: 102, x: 192, y: 102},
- {b: 512, w: 102, x: 320, y: 512},
- {b: 118, w: 102, x: 449, y: 0}
- ].forEach(function(values, i) {
- expect(meta1.data[i]._model.base).toBeCloseToPixel(values.b);
- expect(meta1.data[i]._model.width).toBeCloseToPixel(values.w);
- expect(meta1.data[i]._model.x).toBeCloseToPixel(values.x);
- expect(meta1.data[i]._model.y).toBeCloseToPixel(values.y);
- });
- });
-
- it('should update elements when the scales are stacked and the y axis is logarithmic and data is strings', function() {
- var chart = window.acquireChart({
- type: 'bar',
- data: {
- datasets: [{
- data: ['10', '100', '10', '100'],
- label: 'dataset1'
- }, {
- data: ['100', '10', '0', '100'],
- label: 'dataset2'
- }],
- labels: ['label1', 'label2', 'label3', 'label4']
- },
- options: {
- legend: false,
- title: false,
- datasets: {
- bar: {
- barPercentage: 1,
- }
- },
- scales: {
- x: {
- type: 'category',
- display: false,
- stacked: true,
- },
- y: {
- type: 'logarithmic',
- display: false,
- stacked: true
- }
- }
- }
- });
-
- var meta0 = chart.getDatasetMeta(0);
-
- [
- {b: 512, w: 102, x: 64, y: 512},
- {b: 512, w: 102, x: 192, y: 118},
- {b: 512, w: 102, x: 320, y: 512},
- {b: 512, w: 102, x: 449, y: 118}
- ].forEach(function(values, i) {
- expect(meta0.data[i]._model.base).toBeCloseToPixel(values.b);
- expect(meta0.data[i]._model.width).toBeCloseToPixel(values.w);
- expect(meta0.data[i]._model.x).toBeCloseToPixel(values.x);
- expect(meta0.data[i]._model.y).toBeCloseToPixel(values.y);
- });
-
- var meta1 = chart.getDatasetMeta(1);
-
- [
- {b: 512, w: 102, x: 64, y: 102},
- {b: 118, w: 102, x: 192, y: 102},
- {b: 512, w: 102, x: 320, y: 512},
- {b: 118, w: 102, x: 449, y: 0}
- ].forEach(function(values, i) {
- expect(meta1.data[i]._model.base).toBeCloseToPixel(values.b);
- expect(meta1.data[i]._model.width).toBeCloseToPixel(values.w);
- expect(meta1.data[i]._model.x).toBeCloseToPixel(values.x);
- expect(meta1.data[i]._model.y).toBeCloseToPixel(values.y);
- });
- });
-
it('should draw all bars', function() {
var chart = window.acquireChart({
type: 'bar',