Added support for visualise the graph using a Line chart in the query tool. Fixes #7485

This commit is contained in:
Akshay Joshi
2022-06-22 17:18:51 +05:30
parent 41ceda01d0
commit 93bc1f3c57
38 changed files with 693 additions and 99 deletions

View File

@@ -2,26 +2,29 @@ import jasmineEnzyme from 'jasmine-enzyme';
import React from 'react';
import {mount} from 'enzyme';
import '../helper/enzyme.helper';
import { DATA_POINT_SIZE } from 'sources/chartjs';
import Graphs, {GraphsWrapper, X_AXIS_LENGTH, POINT_SIZE, transformData,
import Graphs, {GraphsWrapper, X_AXIS_LENGTH, transformData,
getStatsUrl, statsReducer} from '../../../pgadmin/dashboard/static/js/Graphs';
describe('Graphs.js', ()=>{
it('transformData', ()=>{
expect(transformData({'Label1': [], 'Label2': []}, 1)).toEqual({
expect(transformData({'Label1': [], 'Label2': []}, 1, false)).toEqual({
labels: [...Array(X_AXIS_LENGTH).keys()],
datasets: [{
label: 'Label1',
data: [],
borderColor: '#00BCD4',
backgroundColor: '#00BCD4',
pointHitRadius: POINT_SIZE,
pointHitRadius: DATA_POINT_SIZE,
pointStyle: 'circle',
},{
label: 'Label2',
data: [],
borderColor: '#9CCC65',
backgroundColor: '#9CCC65',
pointHitRadius: POINT_SIZE,
pointHitRadius: DATA_POINT_SIZE,
pointStyle: 'circle',
}],
refreshRate: 1,
});