igniteui-webcomponents-charts
Version:
Ignite UI Web Components charting components for building rich data visualizations using TypeScript APIs.
183 lines (182 loc) • 19.8 kB
JavaScript
/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE: you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { __makeTemplateObject } from "tslib";
import { TypeRegistrar } from "igniteui-webcomponents-core";
import { html } from "igniteui-webcomponents-core";
var IgcDataChartDefaultTooltipsComponent = /** @class */ /*@__PURE__*/ (function () {
function IgcDataChartDefaultTooltipsComponent() {
var _this = this;
this.anchoredCategoryTooltip = function (context) {
var ret = context ? html(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n <div class='ui-chart-default-tooltip-content'> \n ", "\n ", "\n ", "\n ", "\n <span style=\"color: ", "\">", ": </span>\n <span class=\"ui-tooltip-priority\">", "</span>\n </div>"], ["\n <div class='ui-chart-default-tooltip-content'> \n ", "\n ", "\n ", "\n ", "\n <span style=\"color: ", "\">", ": </span>\n <span class=\"ui-tooltip-priority\">", "</span>\n </div>"])), context.series.xAxis.isDateTime ? html(templateObject_1 || (templateObject_1 = __makeTemplateObject(["<span>", "</span>"], ["<span>", "</span>"])), _this.shortDate(context.series.xAxis.getItemValue(_this.asAny(context.item), 'dateTimeMemberPath'))) : html(templateObject_2 || (templateObject_2 = __makeTemplateObject([""], [""]))), context.series.xAxis.isDateTime ? html(templateObject_3 || (templateObject_3 = __makeTemplateObject(["<br />"], ["<br />"]))) : html(templateObject_4 || (templateObject_4 = __makeTemplateObject([""], [""]))), !context.series.xAxis.isDateTime && context.series.xAxis.label ? html(templateObject_5 || (templateObject_5 = __makeTemplateObject(["<span>", "</span>"], ["<span>", "</span>"])), _this.format(context.series.xAxis.getItemValue(_this.asAny(context.item), 'label'))) : html(templateObject_6 || (templateObject_6 = __makeTemplateObject([""], [""]))), !context.series.xAxis.isDateTime && context.series.xAxis.label ? html(templateObject_7 || (templateObject_7 = __makeTemplateObject(["<br />"], ["<br />"]))) : html(templateObject_8 || (templateObject_8 = __makeTemplateObject([""], [""]))), _this.getBrush(context.series), context.series.title, _this.getAnchoredValue(context.series, context.item)) : html(templateObject_10 || (templateObject_10 = __makeTemplateObject([""], [""])));
return ret;
};
this.anchoredRadialTooltip = function (context) {
var ret = context ? html(templateObject_19 || (templateObject_19 = __makeTemplateObject(["\n <div class='ui-chart-default-tooltip-content'> \n ", "\n ", "\n ", "\n ", "\n <span style=\"color: ", "\">", ": </span>\n <span class=\"ui-tooltip-priority\">", "</span>\n </div>"], ["\n <div class='ui-chart-default-tooltip-content'> \n ", "\n ", "\n ", "\n ", "\n <span style=\"color: ", "\">", ": </span>\n <span class=\"ui-tooltip-priority\">", "</span>\n </div>"])), context.series.angleAxis.isDateTime ? html(templateObject_11 || (templateObject_11 = __makeTemplateObject(["<span>", "</span>"], ["<span>", "</span>"])), _this.shortDate(context.series.angleAxis.getItemValue(_this.asAny(context.item), 'dateTimeMemberPath'))) : html(templateObject_12 || (templateObject_12 = __makeTemplateObject([""], [""]))), context.series.angleAxis.isDateTime ? html(templateObject_13 || (templateObject_13 = __makeTemplateObject(["<br />"], ["<br />"]))) : html(templateObject_14 || (templateObject_14 = __makeTemplateObject([""], [""]))), !context.series.angleAxis.isDateTime && context.series.angleAxis.label ? html(templateObject_15 || (templateObject_15 = __makeTemplateObject(["<span>", "</span>"], ["<span>", "</span>"])), _this.format(context.series.angleAxis.getItemValue(_this.asAny(context.item), 'label'))) : html(templateObject_16 || (templateObject_16 = __makeTemplateObject([""], [""]))), !context.series.angleAxis.isDateTime && context.series.angleAxis.label ? html(templateObject_17 || (templateObject_17 = __makeTemplateObject(["<br />"], ["<br />"]))) : html(templateObject_18 || (templateObject_18 = __makeTemplateObject([""], [""]))), _this.getBrush(context.series), context.series.title, _this.getAnchoredValue(context.series, context.item)) : html(templateObject_20 || (templateObject_20 = __makeTemplateObject([""], [""])));
return ret;
};
this.rangeCategoryTooltip = function (context) {
var ret = context ? html(templateObject_29 || (templateObject_29 = __makeTemplateObject(["\n <div class='ui-chart-default-tooltip-content'> \n ", "\n ", "\n ", "\n ", "\n <span style=\"color: ", "\">", ": </span>\n <span class=\"ui-tooltip-priority\">", " - </span>\n <span class=\"ui-tooltip-priority\">", "</span>\n </div>"], ["\n <div class='ui-chart-default-tooltip-content'> \n ", "\n ", "\n ", "\n ", "\n <span style=\"color: ", "\">", ": </span>\n <span class=\"ui-tooltip-priority\">", " - </span>\n <span class=\"ui-tooltip-priority\">", "</span>\n </div>"])), context.series.xAxis.isDateTime ? html(templateObject_21 || (templateObject_21 = __makeTemplateObject(["<span>", "</span>"], ["<span>", "</span>"])), _this.shortDate(context.series.xAxis.getItemValue(_this.asAny(context.item), 'dateTimeMemberPath'))) : html(templateObject_22 || (templateObject_22 = __makeTemplateObject([""], [""]))), context.series.xAxis.isDateTime ? html(templateObject_23 || (templateObject_23 = __makeTemplateObject(["<br />"], ["<br />"]))) : html(templateObject_24 || (templateObject_24 = __makeTemplateObject([""], [""]))), !context.series.xAxis.isDateTime && context.series.xAxis.label ? html(templateObject_25 || (templateObject_25 = __makeTemplateObject(["<span>", "</span>"], ["<span>", "</span>"])), _this.format(context.series.xAxis.getItemValue(_this.asAny(context.item), 'label'))) : html(templateObject_26 || (templateObject_26 = __makeTemplateObject([""], [""]))), !context.series.xAxis.isDateTime && context.series.xAxis.label ? html(templateObject_27 || (templateObject_27 = __makeTemplateObject(["<br />"], ["<br />"]))) : html(templateObject_28 || (templateObject_28 = __makeTemplateObject([""], [""]))), _this.getBrush(context.series), context.series.title, _this.getLowValue(context.series, context.item), _this.getHighValue(context.series, context.item)) : html(templateObject_30 || (templateObject_30 = __makeTemplateObject([""], [""])));
return ret;
};
this.financialTooltip = function (context) {
var ret = context ? html(templateObject_49 || (templateObject_49 = __makeTemplateObject(["\n <div class='ui-chart-default-tooltip-content'> \n ", "\n ", "\n ", "\n ", "\n <span style=\"color: ", "\">", ": </span>\n <table>\n ", "\n ", "\n ", "\n ", "\n ", "\n </table>\n </div>"], ["\n <div class='ui-chart-default-tooltip-content'> \n ", "\n ", "\n ", "\n ", "\n <span style=\"color: ", "\">", ": </span>\n <table>\n ", "\n ", "\n ", "\n ", "\n ", "\n </table>\n </div>"])), context.series.xAxis.isDateTime ? html(templateObject_31 || (templateObject_31 = __makeTemplateObject(["<span>", "</span>"], ["<span>", "</span>"])), context.itemLabel) : html(templateObject_32 || (templateObject_32 = __makeTemplateObject([""], [""]))), context.series.xAxis.isDateTime ? html(templateObject_33 || (templateObject_33 = __makeTemplateObject(["<br />"], ["<br />"]))) : html(templateObject_34 || (templateObject_34 = __makeTemplateObject([""], [""]))), !context.series.xAxis.isDateTime && context.series.xAxis.label ? html(templateObject_35 || (templateObject_35 = __makeTemplateObject(["<span>", "</span>"], ["<span>", "</span>"])), _this.format(context.series.xAxis.getItemValue(_this.asAny(context.item), 'label'))) : html(templateObject_36 || (templateObject_36 = __makeTemplateObject([""], [""]))), !context.series.xAxis.isDateTime && context.series.xAxis.label ? html(templateObject_37 || (templateObject_37 = __makeTemplateObject(["<br />"], ["<br />"]))) : html(templateObject_38 || (templateObject_38 = __makeTemplateObject([""], [""]))), _this.getBrush(context.series), context.series.title, _this.hasOpen(context.series) ? html(templateObject_39 || (templateObject_39 = __makeTemplateObject(["<tr><td>", ":</td><td>", "</td></tr>"], ["<tr><td>", ":</td><td>", "</td></tr>"])), context.series.actualOpenLabel, _this.getOpenValue(context.series, context.item)) : html(templateObject_40 || (templateObject_40 = __makeTemplateObject([""], [""]))), _this.hasHigh(context.series) ? html(templateObject_41 || (templateObject_41 = __makeTemplateObject(["<tr><td>", ":</td><td>", "</td></tr>"], ["<tr><td>", ":</td><td>", "</td></tr>"])), context.series.actualHighLabel, _this.getHighValue(context.series, context.item)) : html(templateObject_42 || (templateObject_42 = __makeTemplateObject([""], [""]))), _this.hasLow(context.series) ? html(templateObject_43 || (templateObject_43 = __makeTemplateObject(["<tr><td>", ":</td><td>", "</td></tr>"], ["<tr><td>", ":</td><td>", "</td></tr>"])), context.series.actualLowLabel, _this.getLowValue(context.series, context.item)) : html(templateObject_44 || (templateObject_44 = __makeTemplateObject([""], [""]))), _this.hasClose(context.series) ? html(templateObject_45 || (templateObject_45 = __makeTemplateObject(["<tr><td>", ":</td><td>", "</td></tr>"], ["<tr><td>", ":</td><td>", "</td></tr>"])), context.series.actualCloseLabel, _this.getCloseValue(context.series, context.item)) : html(templateObject_46 || (templateObject_46 = __makeTemplateObject([""], [""]))), _this.hasVolume(context.series) ? html(templateObject_47 || (templateObject_47 = __makeTemplateObject(["<tr><td>", ":</td><td>", "</td></tr>"], ["<tr><td>", ":</td><td>", "</td></tr>"])), context.series.actualVolumeLabel, _this.getVolumeValue(context.series, context.item)) : html(templateObject_48 || (templateObject_48 = __makeTemplateObject([""], [""])))) : html(templateObject_50 || (templateObject_50 = __makeTemplateObject([""], [""])));
return ret;
};
this.userAnnotationTooltip = function (context) {
var ret = context ? html(templateObject_51 || (templateObject_51 = __makeTemplateObject(["\n <div class='ui-chart-default-tooltip-content'> \n <div class='ui-chart-user-annotation-tooltip-main-content'></div> \n <div class='ui-chart-user-annotation-tooltip-template-content'>\n </div>\n </div>"], ["\n <div class='ui-chart-default-tooltip-content'> \n <div class='ui-chart-user-annotation-tooltip-main-content'></div> \n <div class='ui-chart-user-annotation-tooltip-template-content'>\n </div>\n </div>"]))) : html(templateObject_52 || (templateObject_52 = __makeTemplateObject([""], [""])));
return ret;
};
this.afterContentInit();
}
IgcDataChartDefaultTooltipsComponent.prototype.ensureDefaultTooltip = function (series) {
if (series.isCategory &&
!series.isVertical &&
!series.isFinancial &&
!series.isRange) {
if (series.showDefaultTooltip) {
series.tooltipTemplate = this.anchoredCategoryTooltip;
}
else {
if (series.tooltipTemplate === this.anchoredCategoryTooltip) {
series.tooltipTemplate = null;
}
}
}
if (series.isRadial) {
if (series.showDefaultTooltip) {
series.tooltipTemplate = this.anchoredRadialTooltip;
}
else {
if (series.tooltipTemplate === this.anchoredRadialTooltip) {
series.tooltipTemplate = null;
}
}
}
if (series.isCategory &&
!series.isVertical &&
!series.isFinancial &&
series.isRange) {
if (series.showDefaultTooltip) {
series.tooltipTemplate = this.rangeCategoryTooltip;
}
else {
if (series.tooltipTemplate === this.rangeCategoryTooltip) {
series.tooltipTemplate = null;
}
}
}
if (series.isFinancial) {
if (series.showDefaultTooltip) {
series.tooltipTemplate = this.financialTooltip;
}
else {
if (series.tooltipTemplate === this.financialTooltip) {
series.tooltipTemplate = null;
}
}
}
if (series.isUserAnnotationLayer) {
if (series.showDefaultTooltip) {
series.tooltipTemplate = this.userAnnotationTooltip;
}
else {
if (series.tooltipTemplate === this.userAnnotationTooltip) {
series.tooltipTemplate = null;
}
}
}
};
IgcDataChartDefaultTooltipsComponent.prototype.format = function (value) {
if (value == undefined || value == null) {
return "";
}
if (value.getTime) {
return this.shortDate(value);
}
return value.toString();
};
IgcDataChartDefaultTooltipsComponent.prototype.shortDate = function (item) {
if (item == undefined || item == null) {
return "";
}
return item.toLocaleDateString() + " " + item.toLocaleTimeString();
};
IgcDataChartDefaultTooltipsComponent.prototype.hasOpen = function (series) {
return series.openMemberPath;
};
IgcDataChartDefaultTooltipsComponent.prototype.getOpenValue = function (series, item) {
return this.getItemValue(series, item, "openMemberPath", series.openMemberPath);
};
IgcDataChartDefaultTooltipsComponent.prototype.hasHigh = function (series) {
return series.highMemberPath;
};
IgcDataChartDefaultTooltipsComponent.prototype.getHighValue = function (series, item) {
return this.getItemValue(series, item, "highMemberPath", series.highMemberPath);
};
IgcDataChartDefaultTooltipsComponent.prototype.hasLow = function (series) {
return series.lowMemberPath;
};
IgcDataChartDefaultTooltipsComponent.prototype.getLowValue = function (series, item) {
return this.getItemValue(series, item, "lowMemberPath", series.lowMemberPath);
};
IgcDataChartDefaultTooltipsComponent.prototype.hasClose = function (series) {
return series.closeMemberPath;
};
IgcDataChartDefaultTooltipsComponent.prototype.getCloseValue = function (series, item) {
return this.getItemValue(series, item, "closeMemberPath", series.closeMemberPath);
};
IgcDataChartDefaultTooltipsComponent.prototype.hasVolume = function (series) {
return series.volumeMemberPath;
};
IgcDataChartDefaultTooltipsComponent.prototype.getVolumeValue = function (series, item) {
return this.getItemValue(series, item, "volumeMemberPath", series.volumeMemberPath);
};
IgcDataChartDefaultTooltipsComponent.prototype.getAnchoredValue = function (series, item) {
return this.getItemValue(series, item, "valueMemberPath", series.valueMemberPath);
};
IgcDataChartDefaultTooltipsComponent.prototype.getXValue = function (series, item) {
return this.getItemValue(series, item, "xMemberPath", series.xMemberPath);
};
IgcDataChartDefaultTooltipsComponent.prototype.getYValue = function (series, item) {
return this.getItemValue(series, item, "yMemberPath", series.yMemberPath);
};
IgcDataChartDefaultTooltipsComponent.prototype.hasRadius = function (series) {
return series.radiusMemberPath !== undefined;
};
IgcDataChartDefaultTooltipsComponent.prototype.getRadiusValue = function (series, item) {
return this.getItemValue(series, item, "radiusMemberPath", series.radiusMemberPath);
};
IgcDataChartDefaultTooltipsComponent.prototype.getAngleValue = function (series, item) {
return this.getItemValue(series, item, "angleMemberPath", series.angleMemberPath);
};
IgcDataChartDefaultTooltipsComponent.prototype.hasValue = function (series) {
return series.valueMemberPath;
};
IgcDataChartDefaultTooltipsComponent.prototype.getItemValue = function (series, item, memberPath, memberPathValue) {
return series.getItemValue(item, memberPath);
};
IgcDataChartDefaultTooltipsComponent.prototype.getValue = function (series, item) {
return this.getItemValue(series, item, "valueMemberPath", series.valueMemberPath);
};
IgcDataChartDefaultTooltipsComponent.prototype.getBrush = function (series) {
return series.safeActualBrush;
};
IgcDataChartDefaultTooltipsComponent.prototype.asAny = function (item) {
return item;
};
IgcDataChartDefaultTooltipsComponent.register = function () {
TypeRegistrar.registerCons("IgcDataChartDefaultTooltipsComponent", IgcDataChartDefaultTooltipsComponent);
};
IgcDataChartDefaultTooltipsComponent.prototype.afterContentInit = function () {
if (this.onContentReady) {
this.onContentReady();
}
};
return IgcDataChartDefaultTooltipsComponent;
}());
export { IgcDataChartDefaultTooltipsComponent };
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21, templateObject_22, templateObject_23, templateObject_24, templateObject_25, templateObject_26, templateObject_27, templateObject_28, templateObject_29, templateObject_30, templateObject_31, templateObject_32, templateObject_33, templateObject_34, templateObject_35, templateObject_36, templateObject_37, templateObject_38, templateObject_39, templateObject_40, templateObject_41, templateObject_42, templateObject_43, templateObject_44, templateObject_45, templateObject_46, templateObject_47, templateObject_48, templateObject_49, templateObject_50, templateObject_51, templateObject_52;