diff --git a/public/themes/bootstrap/scss/_common.scss b/public/themes/bootstrap/scss/_common.scss index 6e1a81a866..abdee5f283 100644 --- a/public/themes/bootstrap/scss/_common.scss +++ b/public/themes/bootstrap/scss/_common.scss @@ -514,10 +514,6 @@ div { &.CodeMirror-scroll { height: auto; } - - &#queryProfiling { - height: 300px; - } } td.explain { diff --git a/public/themes/metro/scss/_common.scss b/public/themes/metro/scss/_common.scss index ab3f1a3da3..61977561e0 100644 --- a/public/themes/metro/scss/_common.scss +++ b/public/themes/metro/scss/_common.scss @@ -767,10 +767,6 @@ div { &.CodeMirror-scroll { height: auto; } - - &#queryProfiling { - height: 300px; - } } td.explain { diff --git a/public/themes/pmahomme/scss/_common.scss b/public/themes/pmahomme/scss/_common.scss index 4131bf7367..875b2acccd 100644 --- a/public/themes/pmahomme/scss/_common.scss +++ b/public/themes/pmahomme/scss/_common.scss @@ -700,10 +700,6 @@ div { &.CodeMirror-scroll { height: auto; } - - &#queryProfiling { - height: 300px; - } } td.explain { diff --git a/resources/js/src/modules/functions/createProfilingChart.ts b/resources/js/src/modules/functions/createProfilingChart.ts index cb92c36470..6d1c3778b2 100644 --- a/resources/js/src/modules/functions/createProfilingChart.ts +++ b/resources/js/src/modules/functions/createProfilingChart.ts @@ -1,4 +1,4 @@ -import $ from 'jquery'; +import { CommonParams } from '../common.ts'; /** * Creates a Profiling Chart. Used in sql.js @@ -10,63 +10,22 @@ import $ from 'jquery'; * @return {object} */ export default function createProfilingChart (target, data) { - // create the chart - var factory = new window.JQPlotChartFactory(); - var chart = factory.createChart(window.ChartType.PIE, target); - - // create the data table and add columns - var dataTable = new window.DataTable(); - dataTable.addColumn(window.ColumnType.STRING, ''); - dataTable.addColumn(window.ColumnType.NUMBER, ''); - dataTable.setData(data); - - var windowWidth = $(window).width(); - var location = 's'; - if (windowWidth > 768) { - location = 'se'; - } - - // draw the chart and return the chart object - chart.draw(dataTable, { - seriesDefaults: { - rendererOptions: { - showDataLabels: true - } - }, - highlighter: { - tooltipLocation: 'se', - sizeAdjust: 0, - tooltipAxes: 'pieref', - formatString: '%s, %.9Ps' - }, - legend: { - show: true, - location: location, - rendererOptions: { - numberColumns: 2 - } - }, - // from https://web.archive.org/web/20190321233412/http://tango.freedesktop.org/Tango_Icon_Theme_Guidelines - seriesColors: [ - '#fce94f', - '#fcaf3e', - '#e9b96e', - '#8ae234', - '#729fcf', - '#ad7fa8', - '#ef2929', - '#888a85', - '#c4a000', - '#ce5c00', - '#8f5902', - '#4e9a06', - '#204a87', - '#5c3566', - '#a40000', - '#babdb6', - '#2e3436' - ] + const lang = CommonParams.get('lang'); + const numberFormat = new Intl.NumberFormat(lang.replace('_', '-'), { + style: 'unit', + unit: 'second', + unitDisplay: 'long', + notation: 'engineering', }); - return chart; + return new window.Chart(target, { + type: 'pie', + data: { labels: data.map(row => row[0]), datasets: [{ data: data.map(row => row[1]) }] }, + options: { + plugins: { + legend: { position: 'right' }, + tooltip: { callbacks: { label: context => context.parsed ? numberFormat.format(context.parsed) : '' } }, + }, + }, + }); } diff --git a/resources/js/src/server/status/monitor.ts b/resources/js/src/server/status/monitor.ts index cb26bb0ce9..36653233ea 100644 --- a/resources/js/src/server/status/monitor.ts +++ b/resources/js/src/server/status/monitor.ts @@ -2210,7 +2210,7 @@ AJAX.registerOnload('server/status/monitor.js', function () { }, width: 'auto', height: 'auto', - resizable: false, + resizable: true, // @ts-ignore buttons: dlgBtns, close: function () { @@ -2346,23 +2346,23 @@ AJAX.registerOnload('server/status/monitor.js', function () { $('#queryAnalyzerDialog').find('div.placeHolder td.chart').append( '' + window.Messages.strProfilingResults + ' ' + $('#profiling_docu').html() + ' ' + '(' + window.Messages.strTable + ', ' + window.Messages.strChart + ')
' + - numberTable + '
'); + numberTable + '
'); $('#queryAnalyzerDialog').find('div.placeHolder a[href="#showNums"]').on('click', function () { - $('#queryAnalyzerDialog').find('#queryProfiling').hide(); + $('#queryAnalyzerDialog').find('#queryProfilingCanvas').hide(); $('#queryAnalyzerDialog').find('table.queryNums').show(); return false; }); $('#queryAnalyzerDialog').find('div.placeHolder a[href="#showChart"]').on('click', function () { - $('#queryAnalyzerDialog').find('#queryProfiling').show(); + $('#queryAnalyzerDialog').find('#queryProfilingCanvas').show(); $('#queryAnalyzerDialog').find('table.queryNums').hide(); return false; }); - profilingChart = createProfilingChart('queryProfiling', chartData); + profilingChart = createProfilingChart('queryProfilingCanvas', chartData); } }); diff --git a/resources/templates/server/status/monitor/index.twig b/resources/templates/server/status/monitor/index.twig index 0aa694863b..db592f80d9 100644 --- a/resources/templates/server/status/monitor/index.twig +++ b/resources/templates/server/status/monitor/index.twig @@ -213,7 +213,7 @@

-
+