This commit is contained in:
Violet Voronetzky 2021-03-10 11:46:38 +02:00
Родитель 7e4aa2b03d
Коммит 5d69932a32
4 изменённых файлов: 5 добавлений и 23 удалений

Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "adx-query-charts",
"version": "1.1.57",
"version": "1.1.58",
"description": "Draw charts from Azure Data Explorer queries",
"main": "dist/index.js",
"types": "dist/index.d.ts",

Просмотреть файл

@ -101,9 +101,6 @@ export class KustoChartHelper implements IChartHelper {
this.chartInfo.dataTransformationInfo.isPartialData = transformed.limitedResults.isPartialData;
}
// Escape columns selection since the columns data is used in the tooltips
this.escapeColumnsSelection(chartOptions);
const visualizerOptions: IVisualizerOptions = {
elementId: this.elementId,
queryResultData: this.transformedQueryResultData,
@ -426,7 +423,7 @@ ${this.getColumnsStr(queryResultData.columns)}`;
const originalColumn = queryResultData.columns[indexOfColumn];
// Add each column name and type to the chartColumns
chartColumns.push(this.escapeColumnName(originalColumn));
chartColumns.push(originalColumn);
}
return notFoundColumns;
@ -519,20 +516,5 @@ ${this.getColumnsStr(queryResultData.columns)}`;
this.finishDrawing(resolve, chartOptions);
}
private escapeColumnsSelection(chartOptions: IChartOptions): void {
chartOptions.columnsSelection = {
xAxis: chartOptions.columnsSelection.xAxis && this.escapeColumnName(chartOptions.columnsSelection.xAxis),
yAxes: chartOptions.columnsSelection.yAxes && chartOptions.columnsSelection.yAxes.map(y => this.escapeColumnName(y)),
splitBy: chartOptions.columnsSelection.splitBy && chartOptions.columnsSelection.splitBy.map(s => this.escapeColumnName(s))
};
}
private escapeColumnName(originalColumn: IColumn): IColumn {
return {
name: <string>Utilities.escapeStr(originalColumn.name),
type: originalColumn.type
};
}
//#endregion Private methods
}

Просмотреть файл

@ -163,7 +163,6 @@ export class Pie extends Chart {
}
protected /*override*/ getDataPoint(chartOptions: IChartOptions, point: Highcharts.Point): IDataPoint {
const seriesColumnName: string = point.series.name;
const xColumn: IColumn = chartOptions.columnsSelection.xAxis;
const splitBy = chartOptions.columnsSelection.splitBy;
let seriesColumn: IColumn;
@ -172,7 +171,7 @@ export class Pie extends Chart {
if (splitBy && splitBy.length > 0) {
// Find the current key column
const keyColumnIndex = _.findIndex(splitBy, (col) => {
return col.name === point.series.name
return col.name === point.series.name;
});
seriesColumn = splitBy[keyColumnIndex];

Просмотреть файл

@ -8,6 +8,7 @@ import { Utilities } from "../../../common/utilities";
export class Formatter {
public static getSingleTooltip(chartOptions: IChartOptions, column: IColumn, originalValue: any, columnName?: string, valueSuffix: string = ''): string {
const maxLabelWidth: number = 100;
let escapedColumnName = Utilities.escapeStr(columnName || column.name);
let formattedValue = '';
if(originalValue != undefined) {
@ -19,7 +20,7 @@ export class Formatter {
}
}
return `<tr><td>${columnName || column.name}: </td><td><b>${formattedValue + valueSuffix}</b></td></tr>`;
return `<tr><td>${escapedColumnName}: </td><td><b>${formattedValue + valueSuffix}</b></td></tr>`;
}
public static getLabelsFormatter(chartOptions: IChartOptions, column: IColumn, useHTML: boolean): Highcharts.FormatterCallbackFunction<Highcharts.AxisLabelsFormatterContextObject<number>> {