Built files from Bizgaze WebServer
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

chartbuilder.js 171KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827
  1. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  2. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  3. return new (P || (P = Promise))(function (resolve, reject) {
  4. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  5. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  6. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  7. step((generator = generator.apply(thisArg, _arguments || [])).next());
  8. });
  9. };
  10. var Unibase;
  11. (function (Unibase) {
  12. let Platform;
  13. (function (Platform) {
  14. let Analytics;
  15. (function (Analytics) {
  16. let Charts;
  17. (function (Charts) {
  18. class ChartBuilder extends Analytics.Components._Chart {
  19. constructor() {
  20. super();
  21. this.colorColumn = [];
  22. this.colorApplyColumn = [];
  23. this.ColorPickerRightNav = true;
  24. this.IsclickedSelect2Caret = false;
  25. this._chartBuilder = this;
  26. this._reportBuilderTemplate = Analytics.Reports.ReportBuilder_Template.Instance();
  27. this._pivot = Analytics.Reports.Pivot.Instance();
  28. }
  29. loadChartIcons() {
  30. var instance = this;
  31. let html = `<button class="btn btn-icon btn-icon-circle text-white ChartIcons bg-success" disabled="true" id="ChartIcon_Default"><i class="fa fa-home"></i></button><button class="btn btn-icon btn-icon-circle btn-icon-style-3" id="ChartIcon_FullScreen"><i class="fa fa-expand"></i></button><button class="btn btn-icon btn-icon-circle text-white ChartIcons bg-success" disabled="true" id="ChartIcon_edit"><i class="fa fa-pencil-square-o"></i></button><button class="btn btn-icon btn-icon-circle btn-icon-style-3 hidden" id="ChartIcon_PaintBrush"><i class="fa fa-paint-brush"></i></button><button class="btn btn-icon btn-icon-circle btn-icon-style-3 ChartIcons hidden" id="ChartIcon_ToolTip"><i class="fa fa-comment"></i></button><button class="btn btn-icon btn-icon-circle btn-icon-style-3 ChartIcons hidden" id="ChartIcon_ChartSettings"><i class="fa fa-cog"> </i></button><button class="btn btn-icon btn-icon-circle btn-icon-style-3 ChartIcons hidden" id="ChartIcon_Forms"><i class="fa fa-bookmark"></i></button></button>`;
  32. $("#bl-nav-chart").html(html);
  33. $("#bl-nav-chart").height($("#chart-container").height());
  34. $(".ChartIcons").click(function () {
  35. $(".ChartIcons").addClass("btn-icon-style-3").removeClass("text-white bg-success").removeAttr("disabled");
  36. $(this).removeClass("btn-icon-style-3").addClass("text-white bg-success").attr("disabled", "true");
  37. });
  38. $("#ChartIcon_Default").click(function () {
  39. instance.changeRightNav("Default");
  40. });
  41. $("#ChartIcon_FullScreen").click(function () {
  42. let panel = '_modal_bizgaze_popup_ChartFullScreen' + moment().unix();
  43. let margin = "mt-70 mb-70 ml-100 mr-100";
  44. let colSpan = "col-sm-10";
  45. var modalhtml = `<div class="_bizgaze_popup_container shadow-left shadow-xl modal right bg-light ` + colSpan + ` p-0 ` + margin + `" id="` + panel + `"><div class="card">
  46. <div class="modal-header"> <span class="text-center col-sm-11" style="text-align:center"> Chart Preview </span> <span class="pull-right" id="Close_ChartFullScreen"> <i class="fa fa-close"> </i> </span> </div>
  47. <div class="modal-body" style="height:500px">
  48. <div id="legend_FullScreen"></div>
  49. <div id="ChartCanvasDiv_FullScreen" style="position: relative; height: 67vh; width: 67vw;" class="ml-30">
  50. <canvas id="myChart_FullScreen" class="ml-10"></canvas>
  51. </div>
  52. </div></div></div>`;
  53. $("#_bizgaze_modal").before(modalhtml);
  54. instance.chartType("myChart_FullScreen");
  55. $('#' + panel).modal('show');
  56. $("#Close_ChartFullScreen").click(function () {
  57. $(".modal-backdrop").remove();
  58. $('#' + panel).remove();
  59. });
  60. });
  61. $("#ChartIcon_PaintBrush").click(function () {
  62. instance.changeRightNav("PaintBrush");
  63. });
  64. $("#ChartIcon_ToolTip").click(function () {
  65. instance.changeRightNav("ToolTip");
  66. });
  67. $("#ChartIcon_ChartSettings").click(function () {
  68. instance.changeRightNav("ChartSettings");
  69. });
  70. $("#ChartIcon_Forms").click(function () {
  71. });
  72. $('input[name="customRadio1"]:radio').on('change', function (e) {
  73. var type = $('input[type=radio][name=customRadio1]:checked').attr('id');
  74. if (type == "rowRadio") {
  75. instance.colorAppliedOn = Unibase.Platform.Analytics.Enums.ColorType.row;
  76. }
  77. else if (type == "columnRadio") {
  78. instance.colorAppliedOn = Unibase.Platform.Analytics.Enums.ColorType.column;
  79. }
  80. instance.chart_dataSet();
  81. });
  82. $('input[name="lagendtypedataradio"]:radio').on('change', (e) => {
  83. var type = e.currentTarget.id;
  84. if (type == "lagendtypecolumn") {
  85. instance.legendTitleTypeId = Unibase.Platform.Analytics.Enums.LegendTitleType.Column;
  86. }
  87. else if (type == "lagendtypedata") {
  88. instance.legendTitleTypeId = Unibase.Platform.Analytics.Enums.LegendTitleType.Data;
  89. }
  90. instance.chart_dataSet();
  91. });
  92. $("#isdatalabel").change((e) => {
  93. this.isDataLabel = e.target.checked;
  94. });
  95. $("#showtooltipheader_checkbox").change((e) => {
  96. this.isTooltipHeader = e.target.checked;
  97. });
  98. $("#label_length").change((e) => {
  99. this.tickLabelLength = Number(e.target.value);
  100. });
  101. $('body').on('click', '#theme_pre .color-block', function () {
  102. instance.IsColorPalette = true;
  103. instance.ColumnColors = [];
  104. instance.RowColors = [];
  105. var selected_color_block = $(this);
  106. $(selected_color_block).find('div').each(function () {
  107. var colorClassName = $(this).attr('class');
  108. var rgb = $(this).css('background-color');
  109. var color = '';
  110. var parts = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
  111. delete (parts[0]);
  112. for (var i = 1; i <= 3; ++i) {
  113. parts[i] = parseInt(parts[i]).toString(16);
  114. if (parts[i].length == 1)
  115. parts[i] = '0' + parts[i];
  116. }
  117. color = '#' + parts.join('');
  118. instance.ColumnColors.push(color);
  119. instance.RowColors.push(color);
  120. });
  121. instance.chartData();
  122. });
  123. }
  124. changeRightNav(IconName) {
  125. var instance = this;
  126. $(".bl-nav-right").addClass("hidden");
  127. if (IconName == "Default") {
  128. $("#bl-nav-right-default").removeClass("hidden");
  129. if (instance._reportBuilder.reportType == Unibase.Platform.Analytics.Reports.Enums.ReportType.Table) {
  130. $("#XAxis").addClass("hidden");
  131. $("#YAxis").addClass("hidden");
  132. }
  133. }
  134. else if (IconName == "ToolTip") {
  135. $("#bl-nav-right-tooltip").removeClass("hidden");
  136. instance.loadToolTipRightNav();
  137. instance.addColumnColors();
  138. }
  139. else {
  140. $("#bl-nav-right-charttypes").removeClass("hidden");
  141. instance.loadChartTypesRightNav();
  142. }
  143. instance.rightNavSlimScroll();
  144. }
  145. rightNavSlimScroll() {
  146. let elem;
  147. elem = $(".rightnav_body");
  148. var height = parseInt($(".report-builder-body").css("height").replace("px", "")) + $(".modal-footer").height() + 'px';
  149. elem.slimscroll({ height: height, color: '#d6d9da', disableFadeOut: true, borderRadius: 0, size: '6px', enableKeyNavigation: true, opacity: .8 });
  150. }
  151. loadChartTypesRightNav() {
  152. var instance = this;
  153. let html = `<div class="bg-white card"> <div class="card-header"><span>Chart Types</span></div> <div class="card-body col-sm-1"><div class=" btn-group-xs pt-24"><table><tr><td class="pr-2 pb-2"><button type="button" class="btn btn-outline-primary" onclick=Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().chartPreview('bar',1)><span><i><img src="platform/analytics/components/chartbuilder/images/bar-chart.png" height="30" width="30" onerror="ReloadImage(event)"></i></span></button></td><td class="pr-2 pb-2"><button type="button" class="btn btn-outline-primary" onclick="Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().chartPreview('horizontalBar',2)"><span><i><img src="platform/analytics/components/chartbuilder/images/horizontalbar-chart.png" height="30" width="30"></i></span></button></td><td class="pr-2 pb-2"><button type="button" class="btn btn-outline-primary" onclick="Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().chartPreview('area',3)"><span id="AreaChart" value="2"><i aria-hidden="true"><img src="platform/analytics/components/chartbuilder/images/area-chart.png" height="30" width="30"></i></span></button></td></tr><tr><td class="pr-2 pb-2"><button type="button" class="btn btn-outline-primary" onclick="Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().chartPreview('doughnut',4)"><span><i><img src="platform/analytics/components/chartbuilder/images/doughnut-chart.png" height="30" width="30"></i></span></button></td><td class="pr-2 pb-2"><button type="button" class="btn btn-outline-primary" onclick="Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().chartPreview('line',5)"><span><i aria-hidden="true"><img src="platform/analytics/components/chartbuilder/images/line-chart.png" height="30" width="30"></i></span></button></td><td class="pr-2 pb-2"><button type="button" class="btn btn-outline-primary" onclick="Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().chartPreview('pie',6)"><span><i aria-hidden="true"><img src="platform/analytics/components/chartbuilder/images/pie-chart.png" height="30" width="30"></i></span></button></td><tr><td class="pr-2 pb-2"><button type="button" class="btn btn-outline-primary" onclick="Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().chartPreview('stackedBar',7)"><span><i><img src="platform/analytics/components/chartbuilder/images/stacked-bar-chart.png" height="30" width="30"></i></span></button></td><td class="pr-2 pb-2"><button type="button" class="btn btn-outline-primary" onclick="Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().chartPreview('stackedHorizontalBar',8)"><span><i><img src="platform/analytics/components/chartbuilder/images/stacked-horizontalbar-chart.png" height="30" width="30"></i></span></button></td><td class="pr-2 pb-2"><button type="button" class="btn btn-outline-primary" onclick="Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().chartPreview('bubble',9)"><span><i><img src="platform/analytics/components/chartbuilder/images/bubble-chart.png" height="30" width="30"></i></span></button></td><tr class="hidden"><td class="pr-2 pb-2"><button type="button" class="btn btn-outline-primary" onclick="Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().chartPreview()"><span><i><img src="" height="30" width="30"></i></span></button></td><td class="pr-2 pb-2"><button type="button" class="btn btn-outline-primary" onclick="Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().chartPreview('rangeColumn',10)"><span><i><img src="" height="30" width="30"></i></span></button></td><td class="pr-2 pb-2"><button type="button" class="btn btn-outline-primary" onclick="Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().chartPreview('zoomcolumn')"><span><i><img src="" height="30" width="30"></i></span></button></td></tr></table></div> </div> </div>`;
  154. $("#bl-nav-right-charttypes").html(html);
  155. }
  156. loadReportTypeChart(id) {
  157. var instance = this;
  158. if (id != "fa fa-bar-chart-o") {
  159. $('.biz-bldr-wrap').removeClass('chart_view');
  160. $('#chart-container').addClass('hidden');
  161. $("#Categories").removeClass("hidden");
  162. $("#chartPivotBtn").addClass("hidden");
  163. $(".bldr-body").removeClass("biz-body-margin-right");
  164. $(this).attr('title', 'Table View');
  165. let pivotHtml = instance._reportBuilderTemplate.loadPivotForm();
  166. $('#reportBuilderRightNav').html(pivotHtml);
  167. setTimeout(function () { $("#pivot-close-btn").click(); }, 1);
  168. $("#no_of_records").closest(".card").first().addClass("hidden");
  169. $("#linechart").addClass("hidden");
  170. $("#div_base_column").addClass("hidden");
  171. instance._reportBuilder.loadDynmaicFilters(this._reportBuilder.reportid);
  172. }
  173. else {
  174. $('.biz-bldr-wrap').addClass('chart_view');
  175. $('#chart-container').removeClass('hidden');
  176. instance.loadChartContent();
  177. $("#XAxis").removeClass("hidden");
  178. $("#YAxis").removeClass("hidden");
  179. $("#Categories").addClass("hidden");
  180. $("#chartPivotBtn").removeClass("hidden");
  181. $(".bldr-body").addClass("biz-body-margin-right");
  182. $(this).attr('data-original-title', 'Chart View');
  183. instance._reportBuilderTemplate.loadChartSideBar();
  184. this.sortTooltipColumnsEvent();
  185. instance.select2TooltipDataBinding();
  186. instance._chartBuilder.loadPalettes();
  187. $("#no_of_records").closest(".card").first().removeClass("hidden");
  188. $("#div_base_column").removeClass("hidden");
  189. }
  190. if (instance._reportBuilder.isEdit == true) {
  191. instance.setChartTypeIconActive(instance.ChartTypeId);
  192. $('#biz-wrapper').addClass('biz-drawer-pushright');
  193. }
  194. instance._reportBuilder.reportTypeChange(id);
  195. if ($("#QueryBuilder").parent().hasClass("slimScrollDiv")) {
  196. $("#QueryBuilder").parent().addClass("hidden");
  197. }
  198. instance.enableOrDisableChartIcons();
  199. $("#legend-select").val(instance._reportBuilder.legendTypeId);
  200. instance._chartBuilder.loadSelectedLegend(instance._reportBuilder.legendTypeId, false);
  201. }
  202. setChartTypeIconActive(chartTypeId) {
  203. switch (chartTypeId) {
  204. case Unibase.Platform.Analytics.Charts.Enums.ChartType.bar:
  205. $("#chart_type").find('.bar-chart-icon').closest('label').addClass('active');
  206. break;
  207. case Unibase.Platform.Analytics.Charts.Enums.ChartType.horizontalBar:
  208. $("#chart_type").find('.horizontalbar-chart-icon').closest('label').addClass('active');
  209. break;
  210. case Unibase.Platform.Analytics.Charts.Enums.ChartType.area:
  211. $("#chart_type").find('.area-chart-icon').closest('label').addClass('active');
  212. break;
  213. case Unibase.Platform.Analytics.Charts.Enums.ChartType.doughnut:
  214. $("#chart_type").find('.doughnut-chart-icon').closest('label').addClass('active');
  215. break;
  216. case Unibase.Platform.Analytics.Charts.Enums.ChartType.line:
  217. $("#chart_type").find('.line-chart-icon').closest('label').addClass('active');
  218. break;
  219. case Unibase.Platform.Analytics.Charts.Enums.ChartType.pie:
  220. $("#chart_type").find('.pie-chart-icon').closest('label').addClass('active');
  221. break;
  222. case Unibase.Platform.Analytics.Charts.Enums.ChartType.stackedBar:
  223. $("#chart_type").find('.stackedbar-chart-icon').closest('label').addClass('active');
  224. break;
  225. case Unibase.Platform.Analytics.Charts.Enums.ChartType.stackedHorizontalBar:
  226. $("#chart_type").find('.stackedhorizontalbar-chart-icon').closest('label').addClass('active');
  227. break;
  228. case Unibase.Platform.Analytics.Charts.Enums.ChartType.bubble:
  229. $("#chart_type").find('.bubble-chart-icon').closest('label').addClass('active');
  230. break;
  231. }
  232. }
  233. loadTopIcons() {
  234. var instance = this;
  235. let html = `<a class="btn btn-icon btn-flush-dark btn-rounded flush-soft-hover drawer-toggle-link ml-1" id="ReportTypeChart" href="javascript:;" data-tooltip="true" title="Table View"><span class="btn-icon-wrap"><span class="font-awesome-icon"><i class="fa fa-table"></i></span></span></a>`;
  236. $("#bl-report-title").html(html);
  237. let pivotHtml = instance._reportBuilderTemplate.loadPivotForm();
  238. $('#reportBuilderRightNav').html(pivotHtml);
  239. $("#ReportTypeChart").click(function () {
  240. var id = $(this).find('i').toggleClass('fa-table fa-bar-chart-o');
  241. instance.loadReportTypeChart(id[0].className);
  242. $('#tabulatorReportbuilder').toggleClass('contains-chartview');
  243. });
  244. $("#chartPivotBtn").click(function () {
  245. $("#chart-pivot-container").removeClass('hidden');
  246. $("#chart-pivot-container.biz-drawer.drawer-right").css('right', '0px');
  247. $("#chart-appearance-container").addClass('hidden');
  248. });
  249. $('body').on('click', '#chart-pivot-container #pivot-close-btn', function () {
  250. $(this).removeClass('drawer-close');
  251. $("#chart-pivot-container").addClass('hidden');
  252. $("#chart-appearance-container").removeClass('hidden');
  253. });
  254. $("#ReportFilter").click(function () {
  255. $(".report-builder-body").toggleClass("hidden");
  256. instance._reportBuilder.loadQueryBuilderDiv();
  257. });
  258. $("#reset_pivot_details").click(() => {
  259. $("#txt_TimeIntervals").val("0").trigger("change");
  260. $("#PivotColumns_AutoComplete").val("0").trigger("change");
  261. $("#PivotDateType").val("0").trigger("change");
  262. $("#PivotAggrColumn").val("0").trigger("change");
  263. $("#PivotAggrType").val("-1").trigger("change");
  264. $("#PivotRows_Select2").val("").trigger("change").empty();
  265. $("#chktreeexpand_checkbox").prop("checked", false);
  266. $("#PivotChildColumnName_AutoComplete").val("0").trigger("change");
  267. $("#PivotValue_AutoComplete").val("-1").trigger("change");
  268. $("#PivotParentColumnName_AutoComplete").val("0").trigger("change");
  269. $("#pivotType_Select2").val("0").trigger("change");
  270. $("#div_Intervals, #div_PivotDateType, #div_PivotColumns, #div_PivotAggrColumn, #div_PivotAggrType, #div_PivotRows, #div_datatreeexpand, #div_PivotChildColumnName, #div_PivotValue, #div_PivotParentColumnName").addClass("hidden");
  271. if (this._reportBuilder.pivot)
  272. this._reportBuilder.pivot = new PivotColumns();
  273. this._reportBuilder.load_data(this._reportBuilder.table);
  274. });
  275. }
  276. loadChartContent() {
  277. let html = `
  278. <div class="card-header border-0 justify-content-end card-header-action">
  279. <div class="card-action-wrap">
  280. <a href="#" class="inline-block full-screen">
  281. <i class="ion ion-md-expand"></i>
  282. </a>
  283. </div>
  284. </div>
  285. <div class="card-body h-100">
  286. <div id="ChartCanvasDiv" class="h-100 w-100">
  287. <canvas id="myChart"></canvas>
  288. </div>
  289. </div>
  290. `;
  291. $("#chart-container").html(html);
  292. }
  293. formatResultData(data) {
  294. var instance = Unibase.Platform.Analytics.Charts.ChartBuilder.Instance();
  295. if (!data.id || isNaN(Number(data.id))) {
  296. var index = instance.getIndexByDisplayText(data.text, "YAxis");
  297. if (index != -1) {
  298. var ColId = instance.yaxisColumns[index].ColumnId;
  299. data.id = ColId;
  300. return data.text;
  301. }
  302. else
  303. return data.text;
  304. }
  305. if (data.element.selected)
  306. return;
  307. return data.text;
  308. }
  309. ;
  310. formatResult(data) {
  311. return data.text;
  312. }
  313. ;
  314. selectedDatalistColumns() {
  315. var instance = this;
  316. var data = [];
  317. for (let i = 0; i < instance._reportBuilder.datalistColumnsResponseData.length; i++) {
  318. data.push({ id: instance._reportBuilder.datalistColumnsResponseData[i].ColumnId, text: instance._reportBuilder.datalistColumnsResponseData[i].ColumnName });
  319. }
  320. return data;
  321. }
  322. loadSearchSelect2() {
  323. var instance = this;
  324. var data = instance._reportBuilder.getSelectedColumns_Select2_Data_AliasName_As_TextValue();
  325. $("#searchcolumns").empty().unbind().select2({
  326. placeholder: 'Select Search columns',
  327. data: data,
  328. allowClear: true,
  329. }).on('select2:unselect', (e) => {
  330. let removedCol = e.params.data.text;
  331. if (instance._reportBuilder.SearchColumns) {
  332. let searchColumns = instance._reportBuilder.SearchColumns.split('|');
  333. let srchIdx = searchColumns.indexOf(removedCol);
  334. if (srchIdx != -1) {
  335. searchColumns.splice(srchIdx, 1);
  336. instance._reportBuilder.SearchColumns = searchColumns.join("|");
  337. }
  338. }
  339. }).on('select2:select', (e) => {
  340. let selectedCol = e.params.data.text;
  341. if (instance._reportBuilder.SearchColumns) {
  342. instance._reportBuilder.SearchColumns += "|" + selectedCol;
  343. }
  344. else
  345. instance._reportBuilder.SearchColumns = selectedCol;
  346. });
  347. this._reportBuilder.bindSearchColumns();
  348. }
  349. identityColumns() {
  350. var instance = this;
  351. var data = [];
  352. var identityinfo = Unibase.Platform.Membership.Infos.Identity.currentUser;
  353. var keys = Object.keys(identityinfo);
  354. for (let i = 0; i < keys.length; i++) {
  355. data.push({ id: identityinfo[keys[i]], text: "Identity_" + keys[i] });
  356. }
  357. instance._reportBuilder.identityColumnsResponseData = data;
  358. return data;
  359. }
  360. loadIdentitySelect2() {
  361. var instance = this;
  362. var data = [];
  363. var data = instance.identityColumns();
  364. $("#identitycolumns").select2({
  365. placeholder: 'Select Indentity columns',
  366. data: data,
  367. });
  368. }
  369. loadSortColumnsSelect2() {
  370. var instance = this;
  371. let sortData = [{ id: "0", text: "- Select -" }];
  372. sortData = instance._reportBuilder.getSelectedColumns_Select2_Data();
  373. if (instance._reportBuilder.reportType == Unibase.Platform.Analytics.Reports.Enums.ReportType.Chart) {
  374. for (var i = 0; i < instance.ChartSelectedColumns.length; i++) {
  375. let chtCol = instance.ChartSelectedColumns[i];
  376. let idx = sortData.findIndex(x => x.text == instance.ChartSelectedColumns[i].AliasName);
  377. if (idx == -1)
  378. sortData.push({ id: chtCol.ChartColumnId || chtCol.ColumnId && chtCol.ColumnId.toString(), text: chtCol.AliasName });
  379. }
  380. }
  381. $("#sortColumns_select").html("").unbind().select2({
  382. placeholder: 'Select Sort columns',
  383. data: sortData,
  384. }).on('select2:select', function (e) {
  385. let data = e.params.data;
  386. let dataType = instance._reportBuilder.dataType($("#allDatalistColumns #li_" + parseInt(data.id) + " span.datalist_column").attr('data-column-datatype'));
  387. var sortIndex = instance._reportBuilder.getIndexByDisplayText_sortColumnsArray(data.text);
  388. if (sortIndex > -1) {
  389. $("#sortColumns_select").select2('close');
  390. alert("Column - " + data.text + " already exists in sortcolumns select2");
  391. $('#sortColumns_select').val('0').trigger('change');
  392. $('.select2-selection__clear').hide();
  393. return false;
  394. }
  395. var html = instance._reportBuilderTemplate.loadSortSelect2Column(Number(e.params.data.id), e.params.data.text, dataType);
  396. $("#sort_selected_columns").append(html);
  397. instance._reportBuilder.setSelectOption("sortColumns_select");
  398. var selcolIndex = instance._reportBuilder.getIndexByAliasName_selectedColumnsArray(data.text);
  399. instance._reportBuilder.selectedColumns[selcolIndex].SortOrder = "Desc";
  400. instance._reportBuilder.selectedColumns[selcolIndex].SortIndex = instance._reportBuilder.SortColumns.length;
  401. instance._reportBuilder.SortColumns.push({ DisplayText: data.text, SortOrder: "Desc", SortIndex: instance._reportBuilder.SortColumns.length });
  402. var _sort = [];
  403. if (instance._reportBuilder.SortColumns.length > 0) {
  404. for (var s = 0; s < instance._reportBuilder.SortColumns.length; s++) {
  405. _sort.push({ Name: instance._reportBuilder.SortColumns[s].DisplayText, Order: instance._reportBuilder.SortColumns[s].SortOrder });
  406. }
  407. }
  408. instance._reportBuilder.stringifyed_SortColumns = JSON.stringify(_sort);
  409. instance._reportBuilder.load_data(instance._reportBuilder.table);
  410. if (instance._reportBuilder.reportType == Unibase.Platform.Analytics.Reports.Enums.ReportType.Chart) {
  411. var cindex = instance.getIndexByDisplayText_ChartSelectedColumns(data.text);
  412. if (cindex > -1) {
  413. instance.ChartSelectedColumns[cindex].SortOrder = "Desc";
  414. instance.ChartSelectedColumns[cindex].SortIndex = instance._reportBuilder.SortColumns.length;
  415. }
  416. if (instance._reportBuilder.TenureReport.length != 0) {
  417. Unibase.Platform.Analytics.Reports.Tenure.Instance().CheckedTenure();
  418. instance._chartBuilder.tenureChart('myChart', instance._reportBuilder.reportid);
  419. }
  420. else {
  421. instance._chartBuilder.chartPreview(instance._chartBuilder.ChartTypeName, instance._chartBuilder.ChartTypeId);
  422. }
  423. }
  424. });
  425. }
  426. loadDynamicFilterSelect(loadDatalistColumns) {
  427. var instance = this;
  428. var data;
  429. if (loadDatalistColumns) {
  430. data = this._reportBuilder.getSelect2DataForDynamicFiltersDatalistColumns();
  431. }
  432. else {
  433. data = this._reportBuilder.getSelectedColumns_Select2_Data();
  434. }
  435. $("#dynamicFilter_select").html("").unbind().select2({
  436. placeholder: 'Select Dynamic Filter',
  437. data: data,
  438. }).on('select2:select', function (e) {
  439. let data = e.params.data;
  440. let dataType = Number($("#allDatalistColumns #li_" + parseInt(data.id) + " span.datalist_column").attr('data-column-datatype'));
  441. var dfillindex = Unibase.Platform.Analytics.Reports.DynamicFilter.Instance().getIndexByDisplayText_dynamicFilterColumns(data.text);
  442. if (dfillindex > -1) {
  443. return MessageHelper.Instance().showError("Column - " + data.text + " already exists in DynamicFilters select2.", "div_ReportBuilderErrorMessage");
  444. }
  445. let rptCol = instance._reportBuilder.selectedColumns.find(x => x.AliasName == data.text);
  446. if (rptCol) {
  447. if (rptCol.ColumnFormat != "" && rptCol.ColumnFormat != "Default") {
  448. instance._reportBuilder.setSelectOption("dynamicFilter_select");
  449. return MessageHelper.Instance().showError("Unable to add formated column in DynamicFilters", "div_ReportBuilderErrorMessage");
  450. }
  451. }
  452. var html = instance._reportBuilderTemplate.loadDynamicFilterColumn(Number(e.params.data.id), e.params.data.text, dataType);
  453. $("#dynamic-list-group-wrapper").append(html);
  454. if (dataType == Unibase.Platform.Analytics.Reports.Enums.DataType.dateTime) {
  455. if ($('[data-toggle="tooltip"]').length > 0)
  456. $('[data-toggle="tooltip"]').tooltip();
  457. var datefill = instance._reportBuilder.dynamicFilters.find(d => d.IsFilterableColumn == data.text) ? true : false;
  458. if (!datefill) {
  459. var model = new DynamicFilterModel();
  460. model.IsFilterableColumn = data.text;
  461. model.DataType = dataType;
  462. model.DisplayName = data.text;
  463. model.Index = instance._reportBuilder.dynamicFilters.length;
  464. model.IsDefault = $('.dynamicfilter-defaultdate_' + data.text).is(':checked');
  465. instance._reportBuilder.dynamicFilters.push(model);
  466. }
  467. }
  468. Unibase.Platform.Analytics.Reports.DynamicFilter.Instance().sortDynamicFilter();
  469. instance._reportBuilder.setSelectOption("dynamicFilter_select");
  470. });
  471. }
  472. select2DataBinding(Event) {
  473. var instance = this;
  474. var data = instance.selectedDatalistColumns();
  475. if (instance._reportBuilder.reportType == Unibase.Platform.Analytics.Reports.Enums.ReportType.Chart) {
  476. instance.coordinate_data(instance.ChartAxis.Horizontal, data);
  477. instance.coordinate_data(instance.ChartAxis.Vertical, data);
  478. instance.select2TooltipDataBinding();
  479. instance.bindChartBaseColumnSelect2();
  480. }
  481. instance.loadSearchSelect2();
  482. instance.loadIdentitySelect2();
  483. instance.loadSortColumnsSelect2();
  484. instance.loadDynamicFilterSelect(instance._reportBuilder.showDynamicFilters);
  485. if (Event == "") {
  486. instance.loadCategoriesSelect2();
  487. $("#groupby_select").off('select2:select').off('select2:unselect').off('select2:selecting');
  488. $("#groupby_select").select2({
  489. placeholder: 'Select GroupBy columns',
  490. data: data,
  491. }).on('select2:select', function (e) {
  492. let data = e.params.data;
  493. let dataType = Number($("#allDatalistColumns #li_" + e.params.data.id + " span.datalist_column").attr('data-column-datatype'));
  494. if (instance._reportBuilder.reportType == Unibase.Platform.Analytics.Reports.Enums.ReportType.Chart) {
  495. let gObj = {
  496. ColumnId: Number(data.id),
  497. ColumnName: data.text,
  498. DisplayText: data.text,
  499. AliasName: data.text,
  500. DataType: dataType,
  501. CoordinateTypeId: instance.ChartAxis.GroupBy,
  502. ColorType: Unibase.Platform.Analytics.Enums.ColorType.row,
  503. divId: "groupby_selected_columns"
  504. };
  505. instance.selected_Coordinate(gObj);
  506. instance.addColumnColors();
  507. instance.loadSortColumnsSelect2();
  508. }
  509. else {
  510. let dataTypeString = $("#allDatalistColumns #li_" + parseInt(data.id) + " span.datalist_column").attr('data-column-datatype');
  511. let dataType = Number($("#allDatalistColumns #li_" + e.params.data.id + " span.datalist_column").attr('data-column-datatype'));
  512. let Index = instance._reportBuilder.getIndexByColumnName_selectedColumnsArray(data.text);
  513. var sel_Col = instance._reportBuilder.selectedColumns[Index];
  514. if (sel_Col)
  515. var grpCol = sel_Col.GroupBy;
  516. if (!grpCol) {
  517. if (Index != -1) {
  518. instance._reportBuilder.selectedColumns[Index].GroupBy = true;
  519. }
  520. else {
  521. var selCol = new SelectedColumns();
  522. selCol.ColumnId = parseInt(data.id);
  523. selCol.ColumnName = data.text;
  524. selCol.DlColumnName = instance._reportBuilder.getDlColumn_ByColumnId_datalistColumnsArray(parseInt(data.id));
  525. selCol.ColumnIndex = instance._reportBuilder.selectedColumns.length;
  526. selCol.DataType = dataType;
  527. selCol.Isvisible = true;
  528. selCol.GroupBy = true;
  529. selCol.AliasName = data.text;
  530. selCol.DisplayText = data.text;
  531. selCol.GroupByCategory = false;
  532. instance._reportBuilder._selectedColumns(selCol);
  533. }
  534. var html = instance._reportBuilderTemplate.loadSelect2Column(parseInt(data.id), data.text, dataType);
  535. $("#groupby_selected_columns").append(html);
  536. instance._reportBuilder.setSelectOption("groupby_select");
  537. $(".dsl_column_filters").addClass('hidden');
  538. instance._reportBuilder.load_data(instance._reportBuilder.table);
  539. }
  540. else {
  541. $("#groupby_select").select2('close');
  542. alert("Column - " + data.text + " already exists in groupby select2. Please change display text and try again");
  543. return false;
  544. }
  545. }
  546. }).on('select2:selecting', function (e) {
  547. let data = e.params.args.data;
  548. var index = -1;
  549. index = instance._reportBuilder.getIndexByAliasName_selectedColumnsArray(data.text);
  550. let x_index = instance.getIndexByDisplayText(data.text, instance.ChartAxis.Horizontal);
  551. let y_index = instance.getIndexByDisplayText(data.text, instance.ChartAxis.Vertical);
  552. let grp_index = instance.getIndexByDisplayText(data.text, instance.ChartAxis.GroupBy);
  553. let Select2Type = "";
  554. if (x_index != -1) {
  555. Select2Type = instance.ChartAxis.Horizontal;
  556. }
  557. if (y_index != -1) {
  558. Select2Type = instance.ChartAxis.Vertical;
  559. }
  560. if (grp_index != -1) {
  561. Select2Type = instance.ChartAxis.GroupBy;
  562. }
  563. });
  564. $("#line_chart_select").off('select2:select').off('select2:unselect').off('select2:selecting');
  565. $("#line_chart_select").select2({
  566. placeholder: 'Select Line Chart columns',
  567. data: data,
  568. }).on("select2:select", (e) => {
  569. let data = e.params.data;
  570. let dataType = Number($("#allDatalistColumns #li_" + e.params.data.id + " span.datalist_column").attr('data-column-datatype'));
  571. if (instance._reportBuilder.reportType == Unibase.Platform.Analytics.Reports.Enums.ReportType.Chart) {
  572. let gObj = {
  573. ColumnId: Number(data.id),
  574. ColumnName: data.text,
  575. DisplayText: data.text,
  576. AliasName: data.text,
  577. DataType: dataType,
  578. CoordinateTypeId: instance.ChartAxis.LineChart,
  579. ColorType: Unibase.Platform.Analytics.Enums.ColorType.row,
  580. divId: "line_chart_selected_columns"
  581. };
  582. instance.selected_Coordinate(gObj);
  583. instance.addColumnColors();
  584. instance.loadSortColumnsSelect2();
  585. instance.coordinate_Elements(false, false, false, false, true, false);
  586. instance.ChartTypeId = Unibase.Platform.Analytics.Charts.Enums.ChartType.barWithLine;
  587. }
  588. });
  589. instance.bindChartBaseColumnSelect2();
  590. }
  591. }
  592. coordinate_data(CoordinateType, data) {
  593. var instance = this;
  594. var divId = "";
  595. let tmpRsltData = instance.formatResult;
  596. if (CoordinateType == instance.ChartAxis.Vertical) {
  597. tmpRsltData = instance.formatResultData;
  598. }
  599. $("#" + CoordinateType.toLowerCase() + "_select").off('select2:selecting').off('select2:select');
  600. $("#" + CoordinateType.toLowerCase() + "_select").select2({
  601. placeholder: 'Select ' + CoordinateType + ' columns',
  602. data: data,
  603. templateResult: tmpRsltData,
  604. sorter: data => data.sort((a, b) => a.text.localeCompare(b.text)),
  605. }).on('select2:selecting', function (e) {
  606. let data = e.params.args.data;
  607. var index = -1;
  608. index = instance._reportBuilder.getIndexByAliasName_selectedColumnsArray(data.text);
  609. let x_index = instance.getIndexByDisplayText(data.text, instance.ChartAxis.Horizontal);
  610. let y_index = instance.getIndexByDisplayText(data.text, instance.ChartAxis.Vertical);
  611. let grp_index = instance.getIndexByDisplayText(data.text, instance.ChartAxis.GroupBy);
  612. let Select2Type = "";
  613. if (x_index != -1) {
  614. Select2Type = instance.ChartAxis.Horizontal;
  615. }
  616. if (y_index != -1) {
  617. Select2Type = instance.ChartAxis.Vertical;
  618. }
  619. if (grp_index != -1) {
  620. Select2Type = instance.ChartAxis.GroupBy;
  621. }
  622. if (Select2Type != "" && instance._reportBuilder.reportType == Unibase.Platform.Analytics.Reports.Enums.ReportType.Chart) {
  623. $("#" + Select2Type.toLowerCase() + "_select").select2('close');
  624. alert("Column - " + data.text + " already exists in " + Select2Type + " select2. Please change display text and try again");
  625. return false;
  626. }
  627. }).on('select2:select', function (e) {
  628. let data = e.params.data;
  629. let dataType = Number($("#allDatalistColumns #li_" + e.params.data.id + " span.datalist_column").attr('data-column-datatype'));
  630. if (CoordinateType == instance.ChartAxis.Vertical) {
  631. divId = "yaxis_selected_columns";
  632. }
  633. else if (CoordinateType == instance.ChartAxis.Horizontal) {
  634. divId = "xaxis_selected_columns";
  635. }
  636. else {
  637. divId = "groupby_selected_columns";
  638. }
  639. let obj = {
  640. ColumnId: Number(data.id),
  641. ColumnName: data.text,
  642. AliasName: data.text,
  643. DisplayText: data.text,
  644. DataType: dataType,
  645. CoordinateTypeId: CoordinateType,
  646. ColorType: Unibase.Platform.Analytics.Enums.ColorType.column,
  647. divId: divId
  648. };
  649. instance.selected_Coordinate(obj);
  650. if (instance._reportBuilder.TenureReport.length == 0)
  651. instance.chartPreview('bar', Unibase.Platform.Analytics.Charts.Enums.ChartType.bar);
  652. });
  653. }
  654. coordinate_Elements(XAxis, YAxis, GroupBy, ToolTip, LineChart, BaseColumn) {
  655. var instance = this;
  656. let chartArray = [];
  657. if (XAxis == true) {
  658. for (var i = 0; i < instance.xaxisColumns.length; i++) {
  659. chartArray.push(instance.xaxisColumns[i]);
  660. }
  661. }
  662. if (YAxis == true) {
  663. for (var i = 0; i < instance.yaxisColumns.length; i++) {
  664. chartArray.push(instance.yaxisColumns[i]);
  665. }
  666. }
  667. if (GroupBy == true) {
  668. for (var i = 0; i < instance.groupColumns.length; i++) {
  669. chartArray.push(instance.groupColumns[i]);
  670. }
  671. }
  672. if (LineChart) {
  673. for (var i = 0; i < instance.lineChartColumns.length; i++) {
  674. chartArray.push(instance.lineChartColumns[i]);
  675. }
  676. }
  677. if (BaseColumn) {
  678. for (var i = 0; i < instance.chartBaseColumns.length; i++) {
  679. let cIdx = chartArray.findIndex(x => x.AliasName == instance.chartBaseColumns[i].AliasName);
  680. if (cIdx == -1) {
  681. instance.chartBaseColumns[i].IsBaseColumn = true;
  682. chartArray.push(instance.chartBaseColumns[i]);
  683. }
  684. else {
  685. chartArray[cIdx].IsBaseColumn = true;
  686. }
  687. }
  688. }
  689. if (ToolTip == true) {
  690. if (instance.toolTipArray.length > 0) {
  691. for (var i = 0; i < instance.toolTipArray.length; i++) {
  692. var tolcol = chartArray.find(x => x.AliasName == instance.toolTipArray[i].AliasName) ? true : false;
  693. if (tolcol != true) {
  694. chartArray.push(instance.toolTipArray[i]);
  695. }
  696. }
  697. }
  698. }
  699. return chartArray;
  700. }
  701. coordinate_DropDown(Select2Id) {
  702. var instance = this;
  703. $("#" + Select2Id).find(".select2-selection__choice span").removeClass('select2-selection__choice__remove');
  704. $("#" + Select2Id).find(".select2-selection__choice span").empty();
  705. $("#" + Select2Id).find(".select2-selection__choice span").css('float', 'right');
  706. var arry = [];
  707. if (Select2Id == instance.ChartAxis.Horizontal) {
  708. arry = instance.xaxisColumns;
  709. }
  710. else if (Select2Id == instance.ChartAxis.Vertical) {
  711. arry = instance.yaxisColumns;
  712. }
  713. else if (Select2Id == instance.ChartAxis.GroupBy) {
  714. arry = instance.groupColumns;
  715. }
  716. else if (Select2Id == instance.ChartAxis.LineChart) {
  717. arry = instance.lineChartColumns;
  718. }
  719. else if (Select2Id == instance.ChartAxis.BaseColumn) {
  720. arry = instance.chartBaseColumns;
  721. }
  722. for (var i = 0; i < arry.length; i++) {
  723. var ElementName = arry[i].ColumnName;
  724. var ElementId = arry[i].ColumnId;
  725. var DisplayText = arry[i].DisplayText;
  726. var len = $("#" + Select2Id).find(".select2-selection__rendered").find(".select2-selection__choice").length;
  727. for (var l = 0; l <= len; l++) {
  728. var m = l + 1;
  729. var DisplayText_length = $("#" + Select2Id).find(".select2-selection__rendered").find("[title='" + DisplayText + "']:nth-child(" + m + ")").length;
  730. var length = $("#" + Select2Id).find(".select2-selection__rendered").find("[title='" + ElementName + "']:nth-child(" + m + ")").length;
  731. if (DisplayText_length != 0) {
  732. break;
  733. }
  734. if (length > 0) {
  735. $("#" + Select2Id).find(".select2-selection__rendered").find("[title='" + ElementName + "']:nth-child(" + m + ")").attr("title", DisplayText);
  736. break;
  737. }
  738. }
  739. let html = `<div class="dropdown mb-100"><span class="dropdown-toggle caret" onclick="Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().clickedSelect2Caret(` + ElementId + `,'` + DisplayText + `','` + Select2Id + `')" data-toggle="dropdown" aria-expanded="false"></span><ul class="dropdown-menu dropdown-menu_` + DisplayText + `" style='position:relative;'><li><a class="dropdown-item font-13 text-primary text-center" href="javascript:;" onclick="" style="cursor:not-allowed"><strong>` + ElementName + `</strong></a></li><div class="dropdown-divider"></div></li><li id="dropdown_Aggregation_` + DisplayText + `"><div class="sub-dropdown-menu show-on-hover"><a class="dropdown-item font-13" href="javascript:;" onclick='' ><span id = "AggregateOperation"> Aggregation </span></a><div class="dropdown-menu open-left-side"></div></div></li><li><div class="sub-dropdown-menu show-on-hover"><a class="dropdown-item font-13" href="javascript:;" onclick=''><span id = "SortTableColumn"> Sort By </span></a><div class="dropdown-menu open-left-side w-10"><a class="dropdown-item font-13 pr-0 pl-0 SortOrder_` + DisplayText + `" id="SortOrder_` + DisplayText + `_Asc" onclick="javascript: Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().changeSortBy_chart(` + ElementId + `,'` + DisplayText + `','` + Select2Id + `','Asc');" href="javascript:;"><span class="pl-20">Asc<i class="dropdown-icon fa fa-check pull-right hidden text-primary mt-1" style="font-size:12px;" id="DropDown_IsAscInSelect2_` + DisplayText + `"></i></span></a><a class="dropdown-item font-13 pr-0 pl-0 SortOrder_` + DisplayText + `" id="SortOrder_` + DisplayText + `_Desc" onclick="javascript: Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().changeSortBy_chart(` + ElementId + `,'` + DisplayText + `','` + Select2Id + `','Desc');" href="javascript:;"><span class="pl-15">Desc<i class="dropdown-icon fa fa-check pull-right hidden text-primary mt-1" style="font-size:12px;" id="DropDown_IsDescInSelect2_` + DisplayText + `"></i></span></a></div></div></li><li><a class="dropdown-item font-13" href="javascript:;" onclick="Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().showOrHideColumns_chart(` + ElementId + `,'` + DisplayText + `','` + Select2Id + `')"><i class="dropdown-icon fa fa-eye-slash" id="DropDown_Eye_EyeSlash"></i><span id="ShowOrHideColumn">Hide Column</span> </a></li> <li><a class="dropdown-item font-13" href="javascript:;" onchange="Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().changeDisplayText_chart('` + DisplayText + `','` + Select2Id + `')"><input type="text" placeholder="Display Text" class="w-100" id="DisplayText_` + DisplayText + `"> </a></li> <li><a class="dropdown-item font-13" href="javascript:;" class="select2-selection__choice__remove" onclick=''><span id="RemoveSelectedColumnInSelect2" onclick="Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().removeColumn_Select2(` + ElementId + `,'` + DisplayText + `','` + Select2Id + `')"> Remove Column </span></a></li><li><a class="dropdown-item font-13 pr-0" href="javascript:;" onclick="Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().IsFilterableColumnInSelect2_chart(` + ElementId + `,'` + DisplayText + `','` + Select2Id + `')"><span id="IsFilterableColumnInSelect2">IsFilterable<i class="dropdown-icon fa fa-check pl-5 hidden text-primary" style="font-size:15px" id="DropDown_IsFilterableInSelect2_` + DisplayText + `"></i></span> </a></li></ul></div>`;
  740. $("#" + Select2Id).find(".select2-selection__rendered").find("[title='" + DisplayText + "']").html(`<span class="" role="presentation" style="float: right;"></span>` + DisplayText);
  741. $("#" + Select2Id).find("[title='" + DisplayText + "'] [role='presentation']").append(html);
  742. $("#" + Select2Id).find("[title='" + DisplayText + "'] [role='presentation']").addClass("ml-2 mr-2");
  743. }
  744. $(".select2-selection__choice").addClass("bg-primary");
  745. }
  746. clickedSelect2Caret(ElementId, DisplayText, Select2Id) {
  747. var instance = this;
  748. $('#' + Select2Id.toLowerCase() + '_select').select2('close');
  749. if ($("#" + Select2Id).find(".dropdown-menu_" + DisplayText).hasClass('show')) {
  750. $("#" + Select2Id).find(".select2-selection__rendered").find("[title='" + DisplayText + "']").removeClass("bg-success");
  751. }
  752. $("#" + Select2Id).find(".select2-selection__rendered").find(".select2-selection__choice").removeClass("bg-success");
  753. $("#" + Select2Id).find(".select2-selection__rendered").find("[title='" + DisplayText + "']").addClass("bg-success");
  754. instance.IsclickedSelect2Caret = true;
  755. $('#xaxis_select').on('select2:opening', function (e) {
  756. instance.select2_Opening(e, ElementId, DisplayText, instance.ChartAxis.Horizontal);
  757. });
  758. $('#yaxis_select').on('select2:opening', function (e) {
  759. instance.select2_Opening(e, ElementId, DisplayText, instance.ChartAxis.Vertical);
  760. });
  761. $('#groupby_select').on('select2:opening', function (e) {
  762. instance.select2_Opening(e, ElementId, DisplayText, instance.ChartAxis.GroupBy);
  763. });
  764. let html = "";
  765. var Aggr = Unibase.Platform.Analytics.Reports.Enums.AggregationType.none;
  766. var Sortby = "none";
  767. var DisplayText = DisplayText;
  768. var Aggregation = instance._reportBuilder.getAggregationsByDataTypes($("#li_" + ElementId).find("#ColDataType").text());
  769. for (var i = 0; i < Aggregation.length; i++) {
  770. if (i == 0) {
  771. Aggr = Aggregation[i].Value;
  772. }
  773. if (Select2Id == instance.ChartAxis.GroupBy && Aggregation[i].AggrType == "year") {
  774. var html2 = `<div class="dropdown-menu open-right-side" style="width:120px">
  775. <a class="dropdown-item font-13 pr-0 pl-0 Aggregation_Year_` + DisplayText + `" id="Aggr_Year_` + DisplayText + `_Prev_1Yr" onclick="javascript: Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().changeAggregationYear_chart(` + ElementId + `, '` + DisplayText + `', '` + Aggregation[i].Value + `',1); " href="javascript: "><i class="dropdown-icon"></i><span> Prev 1 Year <i class="dropdown-icon fa fa-check pull-right hidden text-primary mt-2 mr-0" style="font-size:12px;" id="DropDown_Year_Prev_1Yr_InSelect2_` + DisplayText + `"></i></span></a>
  776. <a class="dropdown-item font-13 pr-0 pl-0 Aggregation_Year_` + DisplayText + `" id="Aggr_Year_` + DisplayText + `_Prev_2Yrs" onclick="javascript: Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().changeAggregationYear_chart(` + ElementId + `, '` + DisplayText + `', '` + Aggregation[i].Value + `',2); " href="javascript: "><i class="dropdown-icon"></i><span> Prev 2 Years <i class="dropdown-icon fa fa-check pull-right hidden text-primary mt-2 mr-0" style="font-size:12px;" id="DropDown_Year_Prev_2Yrs_InSelect2_` + DisplayText + `"></i></span></a>
  777. <a class="dropdown-item font-13 pr-0 pl-0 Aggregation_Year_` + DisplayText + `" id="Aggr_Year_` + DisplayText + `_Prev_3Yrs" onclick="javascript: Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().changeAggregationYear_chart(` + ElementId + `, '` + DisplayText + `', '` + Aggregation[i].Value + `',3); " href="javascript: "><i class="dropdown-icon"></i><span> Prev 3 Years <i class="dropdown-icon fa fa-check pull-right hidden text-primary mt-2 mr-0" style="font-size:12px;" id="DropDown_Year_Prev_3Yrs_InSelect2_` + DisplayText + `"></i></span></a>
  778. <a class="dropdown-item font-13 pr-0 pl-0 Aggregation_Year_` + DisplayText + `" id="Aggr_Year_` + DisplayText + `_Prev_4Yrs" onclick="javascript: Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().changeAggregationYear_chart(` + ElementId + `, '` + DisplayText + `', '` + Aggregation[i].Value + `',4); " href="javascript: "><i class="dropdown-icon"></i><span> Prev 4 Years <i class="dropdown-icon fa fa-check pull-right hidden text-primary mt-2 mr-0" style="font-size:12px;" id="DropDown_Year_Prev_4Yrs_InSelect2_` + DisplayText + `"></i></span></a>
  779. </div>`;
  780. }
  781. html += `<a class="dropdown-item font-13 pr-0 pl-0 Aggregation_` + DisplayText + `" id="Aggr_` + DisplayText + `_` + Aggregation[i].Value + `" onclick="javascript: Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().changeAggregation_chart(` + ElementId + `, '` + DisplayText + `', '` + Select2Id + `',` + Aggregation[i].Value + `); " href="javascript: "><i class="dropdown-icon"></i><span>` + Aggregation[i].AggrType + `<i class="dropdown-icon fa fa-check pull-right hidden text-primary mt-2 mr-0" style="font-size:12px;" id="DropDown_` + Aggregation[i].Value + `_InSelect2_` + DisplayText + `"></i></span></a>`;
  782. }
  783. $("#" + Select2Id).find('#dropdown_Aggregation_' + DisplayText).find(".dropdown-menu").html(html);
  784. if (Select2Id == instance.ChartAxis.GroupBy && Aggregation[i - 1].AggrType == "year") {
  785. $("#" + Select2Id).find('#dropdown_Aggregation_' + DisplayText).find("#Aggr_" + DisplayText + "_" + Analytics.Reports.Enums.AggregationType.year).prepend(html2);
  786. $("#" + Select2Id).find('#dropdown_Aggregation_' + DisplayText).find("#Aggr_" + DisplayText + "_" + Analytics.Reports.Enums.AggregationType.year).addClass("sub-dropdown-menu show-on-hover").removeAttr("onclick");
  787. }
  788. if (Select2Id == instance.ChartAxis.Horizontal) {
  789. $("#YAxis").css("z-index", "0");
  790. $("#GroupBy").css("z-index", "0");
  791. $("#XAxis").removeAttr("style");
  792. let Index = instance.getIndexByDisplayText(DisplayText, instance.ChartAxis.Horizontal);
  793. Aggr = instance.xaxisColumns[Index].Aggregation;
  794. Sortby = instance.xaxisColumns[Index].SortOrder;
  795. DisplayText = instance.xaxisColumns[Index].DisplayText;
  796. let IsFilterable = instance.xaxisColumns[Index].IsFilterable;
  797. instance.DropDownValueSetInSelect2_chart(DisplayText, IsFilterable, Aggr, Sortby);
  798. }
  799. else if (Select2Id == instance.ChartAxis.Vertical) {
  800. $("#GroupBy").css("z-index", "0");
  801. $("#XAxis").css("z-index", "0");
  802. $("#YAxis").removeAttr("style");
  803. let Index = instance.getIndexByDisplayText(DisplayText, instance.ChartAxis.Vertical);
  804. Aggr = instance.yaxisColumns[Index].Aggregation;
  805. Sortby = instance.yaxisColumns[Index].SortOrder;
  806. DisplayText = instance.yaxisColumns[Index].DisplayText;
  807. let IsFilterable = instance.yaxisColumns[Index].IsFilterable;
  808. instance.DropDownValueSetInSelect2_chart(DisplayText, IsFilterable, Aggr, Sortby);
  809. }
  810. else {
  811. $("#XAxis, #YAxis, #GroupBy").removeAttr("style");
  812. let Index = instance.getIndexByDisplayText(DisplayText, instance.ChartAxis.GroupBy);
  813. Aggr = instance.groupColumns[Index].Aggregation;
  814. Sortby = instance.groupColumns[Index].SortOrder;
  815. DisplayText = instance.groupColumns[Index].DisplayText;
  816. let IsFilterable = instance.groupColumns[Index].IsFilterable;
  817. instance.DropDownValueSetInSelect2_chart(DisplayText, IsFilterable, Aggr, Sortby);
  818. }
  819. $("#" + Select2Id).find("#DisplayText_" + DisplayText).val(DisplayText);
  820. $("#" + Select2Id).find("#DisplayText_" + DisplayText).focus();
  821. }
  822. select2_Opening(e, ElementId, DisplayText, Select2Id) {
  823. var instance = this;
  824. for (var i = 0; i < $("#" + Select2Id).find(".dropdown-menu_" + DisplayText).children().length; i++) {
  825. if ($("#" + Select2Id).find("[title='" + DisplayText + "']").find(".dropdown-toggle").attr("aria-expanded") == "true") {
  826. e.preventDefault();
  827. }
  828. else {
  829. $("#" + Select2Id).find(".select2-selection__rendered").find("[title='" + DisplayText + "']").removeClass("bg-success");
  830. }
  831. }
  832. if (instance.IsclickedSelect2Caret == true) {
  833. e.preventDefault();
  834. instance.IsclickedSelect2Caret = false;
  835. }
  836. else {
  837. $("#" + Select2Id).find(".select2-selection__rendered").find("[title='" + DisplayText + "']").removeClass("bg-success");
  838. }
  839. }
  840. DropDownValueSetInSelect2_chart(DisplayText, IsFilterable, Aggr, Sortby) {
  841. var instance = this;
  842. if (IsFilterable == true)
  843. $("#DropDown_IsFilterableInSelect2_" + DisplayText).removeClass('hidden');
  844. else
  845. $("#DropDown_IsFilterableInSelect2_" + DisplayText).addClass('hidden');
  846. if (Aggr == 0)
  847. $("#DropDown_" + Aggr + "_InSelect2_" + DisplayText).removeClass('hidden');
  848. else
  849. $("#DropDown_" + Aggr + "_InSelect2_" + DisplayText).removeClass('hidden');
  850. $("#DropDown_IsAscInSelect2_" + DisplayText).addClass('hidden');
  851. $("#DropDown_IsDescInSelect2_" + DisplayText).addClass('hidden');
  852. if (Sortby == "Asc") {
  853. $("#DropDown_IsAscInSelect2_" + DisplayText).removeClass('hidden');
  854. $("#DropDown_IsDesc_" + DisplayText).addClass('hidden');
  855. }
  856. else if (Sortby == "Desc") {
  857. $("#DropDown_IsDescInSelect2_" + DisplayText).removeClass('hidden');
  858. $("#DropDown_IsAsc_" + DisplayText).addClass('hidden');
  859. }
  860. else {
  861. $("#DropDown_IsAscInSelect2_" + DisplayText).addClass('hidden');
  862. $("#DropDown_IsDescInSelect2_" + DisplayText).addClass('hidden');
  863. }
  864. }
  865. showOrHideColumns_chart(ColumnId, DisplayText, Select2Id) {
  866. var instance = this;
  867. let IsHidden = false;
  868. let ColumnName = "";
  869. if ($("#" + Select2Id).find(".select2-selection__rendered").find("[title='" + DisplayText + "']").find("#ShowOrHideColumn").text() == "Hide Column") {
  870. $("#" + Select2Id).find(".select2-selection__rendered").find("[title='" + DisplayText + "']").find("#ShowOrHideColumn").text("Show Column");
  871. $("#" + Select2Id).find(".select2-selection__rendered").find("[title='" + DisplayText + "']").find("#DropDown_Eye_EyeSlash").removeClass("fa-eye-slash").addClass("fa-eye");
  872. IsHidden = true;
  873. }
  874. else {
  875. $("#" + Select2Id).find(".select2-selection__rendered").find("[title='" + DisplayText + "']").find("#ShowOrHideColumn").text("Hide Column");
  876. $("#" + Select2Id).find(".select2-selection__rendered").find("[title='" + DisplayText + "']").find("#DropDown_Eye_EyeSlash").addClass("fa-eye-slash").removeClass("fa-eye");
  877. if (DisplayText == "") {
  878. DisplayText = DisplayText;
  879. }
  880. IsHidden = false;
  881. }
  882. if (Select2Id == instance.ChartAxis.Horizontal) {
  883. let Index = instance.getIndexByDisplayText(DisplayText, instance.ChartAxis.Horizontal);
  884. instance.xaxisColumns[Index].IsHidden = IsHidden;
  885. ColumnName = instance.xaxisColumns[Index].ColumnName;
  886. }
  887. else if (Select2Id == instance.ChartAxis.Vertical) {
  888. let Index = instance.getIndexByDisplayText(DisplayText, instance.ChartAxis.Vertical);
  889. instance.yaxisColumns[Index].IsHidden = IsHidden;
  890. ColumnName = instance.yaxisColumns[Index].ColumnName;
  891. }
  892. else {
  893. let Index = instance.getIndexByDisplayText(DisplayText, instance.ChartAxis.GroupBy);
  894. instance.groupColumns[Index].IsHidden = IsHidden;
  895. ColumnName = instance.groupColumns[Index].ColumnName;
  896. }
  897. instance._reportBuilder.table.toggleColumn(ColumnName);
  898. $(".select2-selection__rendered").find("[title='" + DisplayText + "']").removeClass("bg-success");
  899. }
  900. changeDisplayText_chart(DisplayText, Select2Id) {
  901. var instance = this;
  902. let ColId = 0;
  903. let ColName = "";
  904. let DisplayText_New = $("#" + Select2Id).find("#DisplayText_" + DisplayText).val().toString();
  905. var Index_DisplayTextExists = -1;
  906. var Index = -1;
  907. var arryName = [];
  908. if (Select2Id == instance.ChartAxis.Horizontal) {
  909. Index_DisplayTextExists = instance.getIndexByDisplayText(DisplayText_New, instance.ChartAxis.Horizontal);
  910. Index = instance.getIndexByDisplayText(DisplayText, instance.ChartAxis.Horizontal);
  911. arryName = instance.xaxisColumns;
  912. ColId = instance.xaxisColumns[Index].ColumnId;
  913. ColName = instance.xaxisColumns[Index].ColumnName;
  914. }
  915. else if (Select2Id == instance.ChartAxis.Vertical) {
  916. Index_DisplayTextExists = instance.getIndexByDisplayText(DisplayText_New, instance.ChartAxis.Vertical);
  917. Index = instance.getIndexByDisplayText(DisplayText, instance.ChartAxis.Vertical);
  918. arryName = instance.yaxisColumns;
  919. ColId = instance.yaxisColumns[Index].ColumnId;
  920. ColName = instance.yaxisColumns[Index].ColumnName;
  921. }
  922. else {
  923. Index_DisplayTextExists = instance.getIndexByDisplayText(DisplayText_New, instance.ChartAxis.GroupBy);
  924. Index = instance.getIndexByDisplayText(DisplayText, instance.ChartAxis.GroupBy);
  925. arryName = instance.groupColumns;
  926. ColId = instance.groupColumns[Index].ColumnId;
  927. ColName = instance.groupColumns[Index].ColumnName;
  928. }
  929. if (DisplayText_New != "" && DisplayText_New.indexOf(" ") == -1) {
  930. let selCol_Index = instance._reportBuilder.getIndexByAliasName_selectedColumnsArray(DisplayText_New);
  931. if (selCol_Index == -1) {
  932. arryName[Index].DisplayText = DisplayText_New;
  933. $("#" + Select2Id).find(".select2-selection__rendered").find("[title='" + DisplayText + "']").attr("title", DisplayText_New);
  934. instance.coordinate_DropDown(Select2Id);
  935. }
  936. else {
  937. let x_index = instance.getIndexByDisplayText(DisplayText_New, instance.ChartAxis.Horizontal);
  938. let y_index = instance.getIndexByDisplayText(DisplayText_New, instance.ChartAxis.Vertical);
  939. let grp_index = instance.getIndexByDisplayText(DisplayText_New, instance.ChartAxis.GroupBy);
  940. let Select2Id = "";
  941. if (x_index != -1) {
  942. Select2Id = instance.ChartAxis.Horizontal;
  943. }
  944. if (y_index != -1) {
  945. Select2Id = instance.ChartAxis.Vertical;
  946. }
  947. if (grp_index != -1) {
  948. Select2Id = instance.ChartAxis.GroupBy;
  949. }
  950. $("#DisplayText_" + DisplayText).val(DisplayText);
  951. alert("Column - " + DisplayText_New + " already exists in " + Select2Id + " select2. Please change display text and try again");
  952. return false;
  953. }
  954. }
  955. else {
  956. $("#DisplayText_" + DisplayText).val(DisplayText);
  957. alert("Display text of column - '" + ColName + "' shouldn't be empty and shouldn't contain spaces");
  958. return false;
  959. }
  960. let SelCols_Index = instance._reportBuilder.getIndexByAliasName_selectedColumnsArray(DisplayText);
  961. instance._reportBuilder.selectedColumns[SelCols_Index].DisplayText = DisplayText_New;
  962. instance._reportBuilder.load_data(instance._reportBuilder.table);
  963. var len = 0;
  964. instance.removeColumn_ColorsArray(DisplayText);
  965. instance.addColumnColors();
  966. }
  967. resetSelect2Columns(elementId) {
  968. var instance = this;
  969. switch (elementId) {
  970. case 'sortby_select':
  971. instance._reportBuilder.SortColumns = [];
  972. instance._reportBuilder.stringifyed_SortColumns = "";
  973. $("#sort_selected_columns").html("");
  974. instance._reportBuilder.load_data(instance._reportBuilder.table);
  975. break;
  976. case 'groupby_select':
  977. instance._chartBuilder.groupColumns = [];
  978. for (var i = 0; i < instance._reportBuilder.selectedColumns.length; i++) {
  979. var s_col = instance._reportBuilder.selectedColumns[i];
  980. if (s_col.GroupBy) {
  981. s_col.GroupBy = false;
  982. }
  983. else {
  984. s_col.Aggregation = Analytics.Reports.Enums.AggregationType.none;
  985. }
  986. }
  987. $("#groupby_selected_columns").html("");
  988. instance._reportBuilder.load_data(instance._reportBuilder.table);
  989. break;
  990. case 'categories_select':
  991. $("#categories_selected_columns").html("");
  992. instance._reportBuilder.Categories = [];
  993. for (var i = 0; i < instance._reportBuilder.selectedColumns.length; i++) {
  994. var s_col = instance._reportBuilder.selectedColumns[i];
  995. if (s_col.GroupByCategory)
  996. s_col.GroupByCategory = false;
  997. }
  998. instance._reportBuilder.load_data(instance._reportBuilder.table);
  999. break;
  1000. case 'xaxis_select':
  1001. instance._chartBuilder.xaxisColumns = [];
  1002. $("#xaxis_selected_columns").html("");
  1003. break;
  1004. case 'yaxis_select':
  1005. instance._chartBuilder.yaxisColumns = [];
  1006. $("#yaxis_selected_columns").html("");
  1007. break;
  1008. case 'dynamicFilter_select':
  1009. instance._reportBuilder.dynamicFilters = [];
  1010. $("#dynamic-list-group-wrapper").html("");
  1011. instance._reportBuilder.load_data(instance._reportBuilder.table);
  1012. break;
  1013. }
  1014. }
  1015. removeColumn_ColorsArray(DisplayText) {
  1016. var instance = this;
  1017. var ApplColValueColor = instance.appliedColumnValueColor;
  1018. for (var key in ApplColValueColor) {
  1019. if (key.includes(DisplayText)) {
  1020. delete ApplColValueColor[key];
  1021. ApplColValueColor.length = ApplColValueColor.length - 1;
  1022. }
  1023. }
  1024. var ApplColColor = instance.appliedColumnColor;
  1025. for (var key in ApplColColor) {
  1026. if (key.includes(DisplayText)) {
  1027. delete ApplColColor[key];
  1028. ApplColColor.length = ApplColColor.length - 1;
  1029. }
  1030. }
  1031. }
  1032. removeColumn_Select2(ColumnId, aliasName, Select2Id) {
  1033. var instance = this;
  1034. instance.removeColumn_ColorsArray(aliasName);
  1035. if (Select2Id == instance.ChartAxis.GroupBy) {
  1036. instance._reportBuilder.pivot.PivotRows = [];
  1037. }
  1038. let value = $('#' + Select2Id.toLowerCase() + '_select').val();
  1039. let index = 0;
  1040. let XAxis_Index = -1, YAxis_Index = -1, GroupBy_Index = -1;
  1041. for (var i = 0; i < value.length; i++) {
  1042. if (parseInt(value[i]) == ColumnId) {
  1043. index = i;
  1044. break;
  1045. }
  1046. }
  1047. let Sel_Index = instance._reportBuilder.getIndexByAliasName_selectedColumnsArray(aliasName);
  1048. let ColName = instance._reportBuilder.selectedColumns[Sel_Index].ColumnName;
  1049. value.splice(index, 1);
  1050. $(".select2-selection__rendered").find("[title='" + aliasName + "']").removeClass("bg-success");
  1051. if (Select2Id == instance.ChartAxis.Horizontal) {
  1052. XAxis_Index = instance.getIndexByDisplayText(aliasName, instance.ChartAxis.Horizontal);
  1053. instance.xaxisColumns.splice(XAxis_Index, 1);
  1054. $('#' + Select2Id.toLowerCase() + '_select').val(value).trigger("change");
  1055. }
  1056. else if (Select2Id == instance.ChartAxis.Vertical) {
  1057. YAxis_Index = instance.getIndexByDisplayText(aliasName, instance.ChartAxis.Vertical);
  1058. instance.yaxisColumns.splice(YAxis_Index, 1);
  1059. var len = $("#" + Select2Id.toLowerCase() + "_select").find("option[value='" + ColumnId + "']").length;
  1060. if (len >= 2) {
  1061. $("#" + Select2Id.toLowerCase() + "_select").find("option[value='" + ColumnId + "']")[len - 2].remove();
  1062. $("#" + Select2Id.toLowerCase() + "_select").find("option[value='" + ColumnId + "']")[len - 2].remove();
  1063. }
  1064. else {
  1065. $('#' + Select2Id.toLowerCase() + '_select').val(value).trigger("change");
  1066. }
  1067. }
  1068. else {
  1069. GroupBy_Index = instance.getIndexByDisplayText(aliasName, "GroupBy");
  1070. instance.groupColumns.splice(GroupBy_Index, 1);
  1071. $('#' + Select2Id.toLowerCase() + '_select').val(value).trigger("change");
  1072. }
  1073. XAxis_Index = instance.getIndexByDisplayText(aliasName, instance.ChartAxis.Horizontal);
  1074. YAxis_Index = instance.getIndexByDisplayText(aliasName, instance.ChartAxis.Vertical);
  1075. GroupBy_Index = instance.getIndexByDisplayText(aliasName, instance.ChartAxis.GroupBy);
  1076. if (XAxis_Index == -1 && YAxis_Index == -1 && GroupBy_Index == -1) {
  1077. instance._reportBuilder.selectedColumns.splice(Sel_Index, 1);
  1078. instance._reportBuilder.table.deleteColumn(aliasName);
  1079. instance._reportBuilder.load_data(instance._reportBuilder.table);
  1080. }
  1081. setTimeout(function () {
  1082. instance.coordinate_DropDown(Select2Id);
  1083. if (Select2Id == "YAxis") {
  1084. $("#" + Select2Id.toLowerCase() + "_select").append('<option value="' + ColumnId + '">' + ColName + '</option>');
  1085. }
  1086. }, 100);
  1087. }
  1088. changeAggregation_chart(ColumnId, DisplayText, Select2Id, AggrValue) {
  1089. return __awaiter(this, void 0, void 0, function* () {
  1090. var instance = this;
  1091. if (Select2Id == instance.ChartAxis.Horizontal) {
  1092. let Index = instance.getIndexByDisplayText(DisplayText, instance.ChartAxis.Horizontal);
  1093. instance.xaxisColumns[Index].Aggregation = AggrValue;
  1094. }
  1095. else if (Select2Id == instance.ChartAxis.Vertical) {
  1096. let Index = instance.getIndexByDisplayText(DisplayText, instance.ChartAxis.Vertical);
  1097. instance.yaxisColumns[Index].Aggregation = AggrValue;
  1098. }
  1099. else {
  1100. let Index = instance.getIndexByDisplayText(DisplayText, instance.ChartAxis.GroupBy);
  1101. instance.groupColumns[Index].Aggregation = AggrValue;
  1102. }
  1103. let sel_Index = instance._reportBuilder.getIndexByAliasName_selectedColumnsArray(DisplayText);
  1104. instance._reportBuilder.selectedColumns[sel_Index].Aggregation = AggrValue;
  1105. $(".select2-selection__rendered").find("[title='" + DisplayText + "']").removeClass("bg-success");
  1106. yield instance._reportBuilder.load_data(instance._reportBuilder.table);
  1107. instance.addColumnColors();
  1108. });
  1109. }
  1110. changeAggregationYear_chart(ColumnId, DisplayText, AggrValue, YearComparisonType) {
  1111. return __awaiter(this, void 0, void 0, function* () {
  1112. var instance = this;
  1113. let Index = instance.getIndexByDisplayText(DisplayText, "GroupBy");
  1114. let ColumnName = instance.groupColumns[Index].ColumnName;
  1115. instance.groupColumns[Index].YearComparisonType = YearComparisonType;
  1116. instance.groupColumns[Index].Aggregation = Number(AggrValue);
  1117. let sel_Index = instance._reportBuilder.getIndexByAliasName_selectedColumnsArray(DisplayText);
  1118. instance._reportBuilder.selectedColumns[sel_Index].YearComparisonType = YearComparisonType;
  1119. instance._reportBuilder.selectedColumns[sel_Index].Aggregation = Number(AggrValue);
  1120. yield instance._reportBuilder.getDistinctData(ColumnId, ColumnName, Number(AggrValue));
  1121. $(".select2-selection__rendered").find("[title='" + DisplayText + "']").removeClass("bg-success");
  1122. yield instance._reportBuilder.load_data(instance._reportBuilder.table);
  1123. instance.addColumnColors();
  1124. });
  1125. }
  1126. IsFilterableColumnInSelect2_chart(ColumnId, DisplayText, Select2Id) {
  1127. var instance = this;
  1128. let Index = 0;
  1129. if (Select2Id == instance.ChartAxis.Horizontal) {
  1130. Index = instance.getIndexByDisplayText(DisplayText, instance.ChartAxis.Horizontal);
  1131. let IsFilterable = instance.xaxisColumns[Index].IsFilterable;
  1132. instance.xaxisColumns[Index].IsFilterable = !IsFilterable;
  1133. }
  1134. else if (Select2Id == instance.ChartAxis.Vertical) {
  1135. Index = instance.getIndexByDisplayText(DisplayText, instance.ChartAxis.Vertical);
  1136. let IsFilterable = instance.yaxisColumns[Index].IsFilterable;
  1137. instance.yaxisColumns[Index].IsFilterable = !IsFilterable;
  1138. }
  1139. else {
  1140. Index = instance.getIndexByDisplayText(DisplayText, instance.ChartAxis.GroupBy);
  1141. let IsFilterable = instance.groupColumns[Index].IsFilterable;
  1142. instance.groupColumns[Index].IsFilterable = !IsFilterable;
  1143. }
  1144. Unibase.Platform.Analytics.Components.ReportViewer.Instance().navigationHelper.popup(Index, "", Unibase.Platform.Analytics.Reports.DynamicFilter.Instance(), null, Platform.Helpers.Size.Auto);
  1145. $(".select2-selection__rendered").find("[title='" + DisplayText + "']").removeClass("bg-success");
  1146. }
  1147. changeSortBy_chart(ColumnId, DisplayText, Select2Id, SortByType) {
  1148. var instance = this;
  1149. for (var i = 0; i < instance.xaxisColumns.length; i++) {
  1150. instance.xaxisColumns[i].SortOrder = "none";
  1151. }
  1152. for (var i = 0; i < instance.yaxisColumns.length; i++) {
  1153. instance.yaxisColumns[i].SortOrder = "none";
  1154. }
  1155. for (var i = 0; i < instance.groupColumns.length; i++) {
  1156. instance.groupColumns[i].SortOrder = "none";
  1157. }
  1158. if (Select2Id == instance.ChartAxis.Horizontal) {
  1159. let Index = instance.getIndexByDisplayText(DisplayText, instance.ChartAxis.Horizontal);
  1160. instance.xaxisColumns[Index].SortOrder = SortByType;
  1161. }
  1162. else if (Select2Id == instance.ChartAxis.Vertical) {
  1163. let Index = instance.getIndexByDisplayText(DisplayText, instance.ChartAxis.Vertical);
  1164. instance.yaxisColumns[Index].SortOrder = SortByType;
  1165. }
  1166. else {
  1167. let Index = instance.getIndexByDisplayText(DisplayText, instance.ChartAxis.GroupBy);
  1168. instance.groupColumns[Index].SortOrder = SortByType;
  1169. }
  1170. let Sel_Index = instance._reportBuilder.getIndexByAliasName_selectedColumnsArray(DisplayText);
  1171. instance._reportBuilder.selectedColumns[Sel_Index].SortOrder = SortByType;
  1172. $(".select2-selection__rendered").find("[title='" + DisplayText + "']").removeClass("bg-success");
  1173. instance._reportBuilder.load_data(instance._reportBuilder.table);
  1174. }
  1175. getindexByTooltipArray(ColumnId) {
  1176. var instance = this;
  1177. return instance.toolTipArray.findIndex(x => x.ColumnId == ColumnId);
  1178. }
  1179. pushPivotData() {
  1180. var instance = this;
  1181. var Pivot = instance.groupColumns.filter(g => g.Aggregation == Analytics.Reports.Enums.AggregationType.month || g.Aggregation == Analytics.Reports.Enums.AggregationType.year);
  1182. if (Pivot.length > 0) {
  1183. instance._reportBuilder.pivot.ColumnName = "";
  1184. let Pivot_Agg = instance.yaxisColumns[0];
  1185. if (instance.yaxisColumns.length > 1) {
  1186. alert("While Pivot, need to select only one Y-Axis Column");
  1187. return false;
  1188. }
  1189. if (Pivot_Agg.Aggregation == Analytics.Reports.Enums.AggregationType.none) {
  1190. alert("While Pivot, need to apply aggregation for Y-Axis Column");
  1191. return false;
  1192. }
  1193. instance._reportBuilder.pivot.ColumnName = Pivot[0].ColumnName;
  1194. instance._reportBuilder.pivot.AggColumnName = Pivot_Agg.ColumnName;
  1195. instance._reportBuilder.pivot.AggFuncId = Pivot_Agg.Aggregation;
  1196. instance._reportBuilder.pivot.DateType = Number(Pivot[0].Aggregation);
  1197. }
  1198. else {
  1199. var tenure_len = instance._reportBuilder.TenureReport.length;
  1200. }
  1201. }
  1202. bindChartColumns(chartColumns) {
  1203. var instance = this;
  1204. var _x = [], _y = [], _g = [], _b = [];
  1205. instance.xaxisColumns = [], instance.yaxisColumns = [], instance.groupColumns = [], instance.SelectedValueColorColumns = [], instance.chartBaseColumns = [];
  1206. for (var i = 0; i < chartColumns.length; i++) {
  1207. var chartCol = chartColumns[i];
  1208. let ColId = chartCol.ColumnValue;
  1209. let ColName = chartCol.Name;
  1210. let Color = chartCol.Color;
  1211. const IsNumAbb = chartCol.IsNumAbb;
  1212. var colorType = Unibase.Platform.Analytics.Enums.ColorType;
  1213. instance.CoordinateDisplayText = chartCol.AliasName;
  1214. if (chartCol.IsXaxis == true) {
  1215. _x.push(chartCol.ColumnValue);
  1216. if (chartCol.IsFilterable == true) {
  1217. $("#DropDown_IsFilterableInSelect2_" + chartCol.AliasName).removeClass('hidden');
  1218. if (chartCol.IsFilterable) {
  1219. instance.isFilterable[ColName] = {
  1220. ColumnName: ColName,
  1221. IsFilterable: true
  1222. };
  1223. }
  1224. }
  1225. else {
  1226. $("#DropDown_IsFilterableInSelect2_" + chartCol.AliasName).addClass('hidden');
  1227. }
  1228. let xObj = {
  1229. ColumnId: chartCol.ColumnValue,
  1230. ColumnName: chartCol.Name,
  1231. DisplayText: chartCol.AliasName,
  1232. AliasName: chartCol.AliasName,
  1233. DataType: chartCol.DataType,
  1234. CoordinateTypeId: instance.ChartAxis.Horizontal,
  1235. ColorType: chartCol.ColorAppliedOn,
  1236. divId: "xaxis_selected_columns"
  1237. };
  1238. instance.selected_Coordinate(xObj);
  1239. var index = instance.getIndexByDisplayText(chartCol.AliasName, instance.ChartAxis.Horizontal);
  1240. if (chartCol.AggregationValue != Analytics.Reports.Enums.AggregationType.none) {
  1241. instance.xaxisColumns[index].Aggregation = chartCol.AggregationValue;
  1242. }
  1243. if (chartCol.SortBy != "none") {
  1244. instance.xaxisColumns[index].SortOrder = chartCol.SortBy;
  1245. }
  1246. instance.xaxisColumns[index].IsNumAbb = IsNumAbb;
  1247. $(`#IsNumberAbbrevation_x`).prop('checked', IsNumAbb);
  1248. }
  1249. else if (chartCol.IsYaxis == true) {
  1250. _y.push(chartCol.ColumnValue);
  1251. if (chartCol.IsFilterable == true) {
  1252. $("#DropDown_IsFilterableInSelect2_" + chartCol.AliasName).removeClass('hidden');
  1253. if (chartCol.IsFilterable) {
  1254. instance.isFilterable[ColName] = {
  1255. ColumnName: ColName,
  1256. IsFilterable: true
  1257. };
  1258. }
  1259. }
  1260. else {
  1261. $("#DropDown_IsFilterableInSelect2_" + chartCol.AliasName).addClass('hidden');
  1262. }
  1263. let yObj = {
  1264. ColumnId: chartCol.ColumnValue,
  1265. ColumnName: chartCol.Name,
  1266. DisplayText: chartCol.AliasName,
  1267. AliasName: chartCol.AliasName,
  1268. DataType: chartCol.DataType,
  1269. CoordinateTypeId: instance.ChartAxis.Vertical,
  1270. ColorType: 0,
  1271. divId: "yaxis_selected_columns"
  1272. };
  1273. instance.selected_Coordinate(yObj);
  1274. var index = instance.getIndexByDisplayText(chartCol.AliasName, instance.ChartAxis.Vertical);
  1275. if (chartCol.AggregationValue != Analytics.Reports.Enums.AggregationType.none) {
  1276. instance.yaxisColumns[index].Aggregation = chartCol.AggregationValue;
  1277. }
  1278. if (chartCol.SortBy != "none") {
  1279. instance.yaxisColumns[index].SortOrder = chartCol.SortBy;
  1280. }
  1281. instance.yaxisColumns[index].IsNumAbb = IsNumAbb;
  1282. $(`#IsNumberAbbrevation_y`).prop('checked', IsNumAbb);
  1283. }
  1284. else if (chartCol.IsGroupBy == true) {
  1285. _g.push(chartCol.ColumnValue);
  1286. if (chartCol.IsFilterable == true) {
  1287. $("#DropDown_IsFilterableInSelect2_" + chartCol.AliasName).removeClass('hidden');
  1288. if (chartCol.IsFilterable) {
  1289. instance.isFilterable[ColName] = {
  1290. ColumnName: ColName,
  1291. IsFilterable: true
  1292. };
  1293. }
  1294. }
  1295. else {
  1296. $("#DropDown_IsFilterableInSelect2_" + chartCol.AliasName).addClass('hidden');
  1297. }
  1298. let gObj = {
  1299. ColumnId: chartCol.ColumnValue,
  1300. ColumnName: chartCol.Name,
  1301. DataType: chartCol.DataType,
  1302. DisplayText: chartCol.AliasName,
  1303. AliasName: chartCol.AliasName,
  1304. CoordinateTypeId: instance.ChartAxis.GroupBy,
  1305. ColorType: chartCol.ColorAppliedOn,
  1306. divId: "groupby_selected_columns"
  1307. };
  1308. instance.selected_Coordinate(gObj);
  1309. var index = instance.getIndexByDisplayText(chartCol.AliasName, instance.ChartAxis.GroupBy);
  1310. if (chartCol.AggregationValue != Analytics.Reports.Enums.AggregationType.none) {
  1311. instance.groupColumns[index].Aggregation = chartCol.AggregationValue;
  1312. }
  1313. if (chartCol.SortBy != "none") {
  1314. instance.groupColumns[index].SortOrder = chartCol.SortBy;
  1315. }
  1316. }
  1317. else if (chartCol.IsLineChart == true) {
  1318. _g.push(chartCol.ColumnValue);
  1319. if (chartCol.IsFilterable == true) {
  1320. $("#DropDown_IsFilterableInSelect2_" + chartCol.AliasName).removeClass('hidden');
  1321. if (chartCol.IsFilterable) {
  1322. instance.isFilterable[ColName] = {
  1323. ColumnName: ColName,
  1324. IsFilterable: true
  1325. };
  1326. }
  1327. }
  1328. else {
  1329. $("#DropDown_IsFilterableInSelect2_" + chartCol.AliasName).addClass('hidden');
  1330. }
  1331. let lObj = {
  1332. ColumnId: chartCol.ColumnValue,
  1333. ColumnName: chartCol.Name,
  1334. DataType: chartCol.DataType,
  1335. DisplayText: chartCol.AliasName,
  1336. AliasName: chartCol.AliasName,
  1337. CoordinateTypeId: instance.ChartAxis.LineChart,
  1338. ColorType: chartCol.ColorAppliedOn,
  1339. divId: "line_chart_selected_columns"
  1340. };
  1341. instance.selected_Coordinate(lObj);
  1342. var index = instance.getIndexByDisplayText(chartCol.AliasName, instance.ChartAxis.LineChart);
  1343. if (chartCol.AggregationValue != Analytics.Reports.Enums.AggregationType.none) {
  1344. instance.groupColumns[index].Aggregation = chartCol.AggregationValue;
  1345. }
  1346. if (chartCol.SortBy != "none") {
  1347. instance.lineChartColumns[index].SortOrder = chartCol.SortBy;
  1348. }
  1349. }
  1350. if (chartCol.IsChartBaseColumn) {
  1351. _b.push(chartCol.ColumnValue);
  1352. if (chartCol.IsFilterable == true) {
  1353. $("#DropDown_IsFilterableInSelect2_" + chartCol.AliasName).removeClass('hidden');
  1354. if (chartCol.IsFilterable) {
  1355. instance.isFilterable[ColName] = {
  1356. ColumnName: ColName,
  1357. IsFilterable: true
  1358. };
  1359. }
  1360. }
  1361. else {
  1362. $("#DropDown_IsFilterableInSelect2_" + chartCol.AliasName).addClass('hidden');
  1363. }
  1364. let lObj = {
  1365. ColumnId: chartCol.ColumnValue,
  1366. ColumnName: chartCol.Name,
  1367. DataType: chartCol.DataType,
  1368. DisplayText: chartCol.AliasName,
  1369. AliasName: chartCol.AliasName,
  1370. CoordinateTypeId: instance.ChartAxis.BaseColumn,
  1371. ColorType: chartCol.ColorAppliedOn,
  1372. divId: "base_column_selected_columns"
  1373. };
  1374. instance.selected_Coordinate(lObj);
  1375. var index = instance.getIndexByDisplayText(chartCol.AliasName, instance.ChartAxis.BaseColumn);
  1376. if (chartCol.SortBy && chartCol.SortBy != "none") {
  1377. instance.lineChartColumns[index].SortOrder = chartCol.SortBy;
  1378. }
  1379. instance.coordinate_DropDown(instance.ChartAxis.ChartBase);
  1380. }
  1381. if (chartCol.Color != null) {
  1382. instance.chartViewer_Colors(chartCol.Color, chartCol.ColumnValue, chartCol.Name);
  1383. }
  1384. if (chartCol.IsLineChart == true) {
  1385. _g.push(chartCol.ColumnValue);
  1386. if (chartCol.IsFilterable == true) {
  1387. $("#DropDown_IsFilterableInSelect2_" + chartCol.AliasName).removeClass('hidden');
  1388. if (chartCol.IsFilterable) {
  1389. instance.isFilterable[ColName] = {
  1390. ColumnName: ColName,
  1391. IsFilterable: true
  1392. };
  1393. }
  1394. }
  1395. else {
  1396. $("#DropDown_IsFilterableInSelect2_" + chartCol.AliasName).addClass('hidden');
  1397. }
  1398. let lObj = {
  1399. ColumnId: chartCol.ColumnValue,
  1400. ColumnName: chartCol.Name,
  1401. DataType: chartCol.DataType,
  1402. DisplayText: chartCol.AliasName,
  1403. AliasName: chartCol.AliasName,
  1404. CoordinateTypeId: instance.ChartAxis.LineChart,
  1405. ColorType: chartCol.ColorAppliedOn,
  1406. divId: "line_chart_selected_columns"
  1407. };
  1408. instance.selected_Coordinate(lObj);
  1409. var index = instance.getIndexByDisplayText(chartCol.AliasName, instance.ChartAxis.LineChart);
  1410. if (chartCol.AggregationValue != Analytics.Reports.Enums.AggregationType.none) {
  1411. instance.groupColumns[index].Aggregation = chartCol.AggregationValue;
  1412. }
  1413. if (chartCol.SortBy != "none") {
  1414. instance.lineChartColumns[index].SortOrder = chartCol.SortBy;
  1415. }
  1416. }
  1417. }
  1418. instance.coordinate_DropDown(instance.ChartAxis.Horizontal);
  1419. instance.coordinate_DropDown(instance.ChartAxis.Vertical);
  1420. instance.coordinate_DropDown(instance.ChartAxis.GroupBy);
  1421. instance.CoordinateDisplayText = "";
  1422. }
  1423. reportColumns(crtObj, columns) {
  1424. var instance = this;
  1425. let isTable = this._reportBuilder.reportType == Unibase.Platform.Analytics.Reports.Enums.ReportType.Table ? true : false;
  1426. for (var i = 0; i < columns.length; i++) {
  1427. var col = crtObj.ReportColumns.find(x => x.AliasName == columns[i]["DisplayText"]) ? true : false;
  1428. let rpCol = instance._reportBuilder.selectedColumns.find(x => x.AliasName == columns[i].AliasName);
  1429. if (col != true) {
  1430. var aggr = instance._reportBuilder.selectedColumns.find(x => x.DisplayText == columns[i]["DisplayText"]);
  1431. var sort = instance._reportBuilder.SortColumns.find(x => x.DisplayText == columns[i]["DisplayText"]);
  1432. let ccol = new ReportColumn();
  1433. ccol.ColumnValue = Number(isTable ? columns[i]["ColumnId"] : rpCol.ColumnId);
  1434. ccol.ReportColumnName = columns[i]["ColumnName"];
  1435. ccol.AliasName = columns[i]["AliasName"];
  1436. ccol.DisplayText = columns[i]["DisplayText"];
  1437. ccol.Isvisible = columns[i]["IsHidden"];
  1438. ccol.AggrFuncId = (aggr) ? aggr.Aggregation : columns[i]["Aggregation"];
  1439. ccol.GroupBy = columns[i]["GroupBy"];
  1440. ccol.SortType = (sort) ? sort.SortOrder : columns[i]["SortOrder"];
  1441. ccol.YearComparisonType = columns[i]["YearComparisonType"];
  1442. ccol.DlColumnName = rpCol && rpCol.DlColumnName;
  1443. ccol.DataListColumnName = rpCol && rpCol.DataListColumnName;
  1444. crtObj.ReportColumns.push(ccol);
  1445. }
  1446. }
  1447. return crtObj;
  1448. }
  1449. chartPreview(ChartTypeName, ChartTypeId) {
  1450. var instance = this;
  1451. instance.ChartTypeId = ChartTypeId, instance.ChartTypeName = ChartTypeName;
  1452. instance.Dataset = [], instance.XaxisData = [];
  1453. if (instance._reportBuilder.pivot.ColumnName) {
  1454. instance.chartType('myChart');
  1455. }
  1456. else {
  1457. instance.ChartSelectedColumns = instance._chartBuilder.coordinate_Elements(true, true, true, true, true, true);
  1458. instance._reportBuilder.load_data(instance._reportBuilder.table);
  1459. instance.loadSortColumnsSelect2();
  1460. }
  1461. }
  1462. chartData() {
  1463. var instance = this;
  1464. var sortColumns = [];
  1465. var totalColumns = [];
  1466. instance.fileCacheHelper.loadJsFile("platform/analytics/managers/reportmanager.js", function () {
  1467. instance.fileCacheHelper.loadJsFile('platform/analytics/enums/charttype.js', function () {
  1468. instance.fileCacheHelper.loadJsFile("platform/core/infos/status.js", function () {
  1469. instance.ChartSelectedColumns = instance._chartBuilder.coordinate_Elements(true, true, true, true, true, true);
  1470. for (var i = 0; i < instance._reportBuilder.SortColumns.length; i++) {
  1471. var colName = instance._reportBuilder.SortColumns[i].DisplayText;
  1472. let chartIdx = instance.ChartSelectedColumns.findIndex(x => x.AliasName == colName);
  1473. let reportIdx = instance._reportBuilder.selectedColumns.findIndex(x => x.AliasName == colName);
  1474. if (chartIdx == -1 && reportIdx != -1) {
  1475. let rpCol = instance._reportBuilder.selectedColumns[reportIdx];
  1476. sortColumns.push({
  1477. Aggregation: rpCol.Aggregation,
  1478. AliasName: rpCol.AliasName,
  1479. ChartColumnId: 0,
  1480. ColorType: 1,
  1481. ColumnId: 0,
  1482. ColumnValue: 0,
  1483. ColumnName: rpCol.ColumnName,
  1484. DataType: rpCol.DataType,
  1485. DisplayText: rpCol.DisplayText,
  1486. GroupBy: rpCol.GroupBy,
  1487. IsBaseColumn: false,
  1488. IsFilterable: false,
  1489. IsHidden: !rpCol.Isvisible,
  1490. IsLineChart: false,
  1491. SortOrder: instance._reportBuilder.SortColumns[i].SortOrder,
  1492. XAxis: true,
  1493. YAxis: false,
  1494. });
  1495. }
  1496. }
  1497. let crtObj = new ReportObject();
  1498. crtObj.DataListId = instance._reportBuilder.DataListId;
  1499. crtObj.TopRecords = Number($("#txt_totalrecords").val());
  1500. crtObj.StaticFilter = instance._reportBuilder.queryBuilderString;
  1501. crtObj.SortColumns = instance._reportBuilder.stringifyed_SortColumns;
  1502. crtObj.FromDate = Unibase.Platform.Helpers.NavigationHelper.commonFilter_FromDate;
  1503. crtObj.ToDate = Unibase.Platform.Helpers.NavigationHelper.commonFilter_ToDate;
  1504. crtObj.TopRecords = instance._reportBuilder.topRecords;
  1505. crtObj.ReportTypeId = instance._reportBuilder.reportType;
  1506. totalColumns = instance.ChartSelectedColumns.concat(sortColumns);
  1507. instance.reportColumns(crtObj, totalColumns);
  1508. if (crtObj.ReportColumns.length != 0) {
  1509. instance._reportManager.getTableData(crtObj).then(function (response) {
  1510. if (response.status == Unibase.Data.Status.Success) {
  1511. if (response.result != "") {
  1512. var res = JSON.parse(response.result);
  1513. if (res.Data != "")
  1514. var data = JSON.parse(res.Data);
  1515. if (instance.isColumnRename)
  1516. instance._reportBuilder.load_data(instance._reportBuilder.table);
  1517. else if (instance.yaxisColumns.length != 0)
  1518. instance._reportBuilder.table.replaceData(data);
  1519. instance.ChartData = data;
  1520. instance.chart_dataSet();
  1521. }
  1522. }
  1523. else {
  1524. return MessageHelper.Instance().showError(response.message, "div_ReportBuilderErrorMessage");
  1525. }
  1526. });
  1527. }
  1528. });
  1529. });
  1530. });
  1531. }
  1532. chartColumns() {
  1533. var instance = this;
  1534. instance._reportBuilder.ChartColumns = [];
  1535. for (var c = 0; c < instance.ChartSelectedColumns.length; c++) {
  1536. var TableColors = false;
  1537. let chartSelectedColumn = instance.ChartSelectedColumns[c];
  1538. if (instance.colorApplyColumn.length > 0)
  1539. TableColors = instance.colorApplyColumn.find(x => x.ColumnName == chartSelectedColumn.ColumnName) ? true : false;
  1540. var Columncolor = null;
  1541. var ColumnValueColors = null;
  1542. let colors;
  1543. if ((chartSelectedColumn.IsXAxis != undefined && chartSelectedColumn.IsXAxis != true) || (chartSelectedColumn.XAxis != undefined && chartSelectedColumn.XAxis != true)) {
  1544. var col = instance.Colors[chartSelectedColumn.DisplayText];
  1545. if (col != undefined)
  1546. colors = col.colors;
  1547. }
  1548. else {
  1549. colors = "";
  1550. }
  1551. var tooltip = instance.toolTipArray.find(x => x.AliasName == chartSelectedColumn.AliasName);
  1552. instance._reportBuilder.ChartColumns.push({
  1553. Name: chartSelectedColumn.ColumnName || chartSelectedColumn.Name,
  1554. AliasName: chartSelectedColumn.AliasName,
  1555. ColumnValue: Number(chartSelectedColumn.ColumnId) || Number(chartSelectedColumn.ColumnValue),
  1556. DataType: chartSelectedColumn.DataType,
  1557. AggregationValue: chartSelectedColumn.Aggregation || chartSelectedColumn.AggregationValue,
  1558. Color: colors,
  1559. SortBy: chartSelectedColumn.SortOrder,
  1560. IsToolTip: tooltip ? true : false,
  1561. IsXaxis: chartSelectedColumn.XAxis || chartSelectedColumn.IsXaxis,
  1562. IsYaxis: chartSelectedColumn.YAxis || chartSelectedColumn.IsYaxis,
  1563. IsGroupBy: chartSelectedColumn.GroupBy || chartSelectedColumn.IsGroupBy,
  1564. IsLineChart: chartSelectedColumn.IsLineChart,
  1565. IsFilterable: chartSelectedColumn.IsFilterable,
  1566. ColorAppliedOn: chartSelectedColumn.ColorType || chartSelectedColumn.ColorAppliedOn,
  1567. IsChartBaseColumn: chartSelectedColumn.IsBaseColumn,
  1568. IsNumAbb: chartSelectedColumn.IsNumAbb == undefined ? true : chartSelectedColumn.IsNumAbb,
  1569. });
  1570. }
  1571. }
  1572. colourNameToHex(colour) {
  1573. var colours = {
  1574. "aliceblue": "#f0f8ff", "antiquewhite": "#faebd7", "aqua": "#00ffff", "aquamarine": "#7fffd4", "azure": "#f0ffff",
  1575. "beige": "#f5f5dc", "bisque": "#ffe4c4", "black": "#000000", "blanchedalmond": "#ffebcd", "blue": "#0000ff", "blueviolet": "#8a2be2", "brown": "#a52a2a", "burlywood": "#deb887",
  1576. "cadetblue": "#5f9ea0", "chartreuse": "#7fff00", "chocolate": "#d2691e", "coral": "#ff7f50", "cornflowerblue": "#6495ed", "cornsilk": "#fff8dc", "crimson": "#dc143c", "cyan": "#00ffff",
  1577. "darkblue": "#00008b", "darkcyan": "#008b8b", "darkgoldenrod": "#b8860b", "darkgray": "#a9a9a9", "darkgreen": "#006400", "darkkhaki": "#bdb76b", "darkmagenta": "#8b008b", "darkolivegreen": "#556b2f",
  1578. "darkorange": "#ff8c00", "darkorchid": "#9932cc", "darkred": "#8b0000", "darksalmon": "#e9967a", "darkseagreen": "#8fbc8f", "darkslateblue": "#483d8b", "darkslategray": "#2f4f4f", "darkturquoise": "#00ced1",
  1579. "darkviolet": "#9400d3", "deeppink": "#ff1493", "deepskyblue": "#00bfff", "dimgray": "#696969", "dodgerblue": "#1e90ff",
  1580. "firebrick": "#b22222", "floralwhite": "#fffaf0", "forestgreen": "#228b22", "fuchsia": "#ff00ff",
  1581. "gainsboro": "#dcdcdc", "ghostwhite": "#f8f8ff", "gold": "#ffd700", "goldenrod": "#daa520", "gray": "#808080", "green": "#008000", "greenyellow": "#adff2f",
  1582. "honeydew": "#f0fff0", "hotpink": "#ff69b4",
  1583. "indianred ": "#cd5c5c", "indigo": "#4b0082", "ivory": "#fffff0", "khaki": "#f0e68c",
  1584. "lavender": "#e6e6fa", "lavenderblush": "#fff0f5", "lawngreen": "#7cfc00", "lemonchiffon": "#fffacd", "lightblue": "#add8e6", "lightcoral": "#f08080", "lightcyan": "#e0ffff", "lightgoldenrodyellow": "#fafad2",
  1585. "lightgrey": "#d3d3d3", "lightgreen": "#90ee90", "lightpink": "#ffb6c1", "lightsalmon": "#ffa07a", "lightseagreen": "#20b2aa", "lightskyblue": "#87cefa", "lightslategray": "#778899", "lightsteelblue": "#b0c4de",
  1586. "lightyellow": "#ffffe0", "lime": "#00ff00", "limegreen": "#32cd32", "linen": "#faf0e6",
  1587. "magenta": "#ff00ff", "maroon": "#800000", "mediumaquamarine": "#66cdaa", "mediumblue": "#0000cd", "mediumorchid": "#ba55d3", "mediumpurple": "#9370d8", "mediumseagreen": "#3cb371", "mediumslateblue": "#7b68ee",
  1588. "mediumspringgreen": "#00fa9a", "mediumturquoise": "#48d1cc", "mediumvioletred": "#c71585", "midnightblue": "#191970", "mintcream": "#f5fffa", "mistyrose": "#ffe4e1", "moccasin": "#ffe4b5",
  1589. "navajowhite": "#ffdead", "navy": "#000080",
  1590. "oldlace": "#fdf5e6", "olive": "#808000", "olivedrab": "#6b8e23", "orange": "#ffa500", "orangered": "#ff4500", "orchid": "#da70d6",
  1591. "palegoldenrod": "#eee8aa", "palegreen": "#98fb98", "paleturquoise": "#afeeee", "palevioletred": "#d87093", "papayawhip": "#ffefd5", "peachpuff": "#ffdab9", "peru": "#cd853f", "pink": "#ffc0cb", "plum": "#dda0dd", "powderblue": "#b0e0e6", "purple": "#800080",
  1592. "rebeccapurple": "#663399", "red": "#ff0000", "rosybrown": "#bc8f8f", "royalblue": "#4169e1",
  1593. "saddlebrown": "#8b4513", "salmon": "#fa8072", "sandybrown": "#f4a460", "seagreen": "#2e8b57", "seashell": "#fff5ee", "sienna": "#a0522d", "silver": "#c0c0c0", "skyblue": "#87ceeb", "slateblue": "#6a5acd", "slategray": "#708090", "snow": "#fffafa", "springgreen": "#00ff7f", "steelblue": "#4682b4",
  1594. "tan": "#d2b48c", "teal": "#008080", "thistle": "#d8bfd8", "tomato": "#ff6347", "turquoise": "#40e0d0",
  1595. "violet": "#ee82ee",
  1596. "wheat": "#f5deb3", "white": "#ffffff", "whitesmoke": "#f5f5f5",
  1597. "yellow": "#ffff00", "yellowgreen": "#9acd32", "sky": "#87cefa", "grey": "#808080", "neon": "#eb0450", "pumpkin": "#ff7518", "sun": "#FDB813", "primary": "#007bff", "dark": "#a9a9a9", "smoke": "#738276", "rose": "#ff007f"
  1598. };
  1599. let hexCode = [{ color: "indian red", code: { hex: "#B0171F" }, id: 1 }, { color: "crimson ", code: { hex: "#DC143C " }, id: 2 }, { color: "lightpink ", code: { hex: "#FFB6C1 " }, id: 4 }, { color: "lightpink 1 ", code: { hex: "#FFAEB9 " }, id: 4 }, { color: "lightpink 2 ", code: { hex: "#EEA2AD " }, id: 5 }, { color: "lightpink 3 ", code: { hex: "#CD8C95 " }, id: 6 }, { color: "lightpink 4 ", code: { hex: "#8B5F65 " }, id: 7 }, { color: "pink ", code: { hex: "#FFC0CB " }, id: 8 }, { color: "pink 1", code: { hex: "#FFB5C5 " }, id: 9 }, { color: "pink 2", code: { hex: "#EEA9B8 " }, id: 10 }, { color: "pink 3", code: { hex: "#CD919E " }, id: 11 }, { color: "pink 4", code: { hex: "#8B636C" }, id: 12 }, { color: "palevioletred ", code: { hex: "#DB7093" }, id: 13 }, { color: "palevioletred 1 ", code: { hex: "#FF82AB" }, id: 14 }, { color: "palevioletred 2 ", code: { hex: "#EE799F" }, id: 15 }, { color: "palevioletred 3 ", code: { hex: "#CD6889" }, id: 16 }, { color: "palevioletred 4 ", code: { hex: "#8B475D" }, id: 17 }, { color: "lavenderblush 1 (lavenderblush) ", code: { hex: "#FFF0F5" }, id: 18 }, { color: "lavenderblush 2 ", code: { hex: "#EEE0E5" }, id: 19 }, { color: "lavenderblush 3 ", code: { hex: "#CDC1C5" }, id: 20 }, { color: "lavenderblush 4 ", code: { hex: "#8B8386" }, id: 21 }, { color: "violetred 1 ", code: { hex: "#FF3E96" }, id: 22 }, { color: "violetred 2 ", code: { hex: "#EE3A8C" }, id: 23 }, { color: "violetred 3 ", code: { hex: "#CD3278" }, id: 24 }, { color: "violetred 4 ", code: { hex: "#8B2252" }, id: 25 }, { color: "hotpink ", code: { hex: "#FF69B4" }, id: 26 }, { color: "hotpink 1 ", code: { hex: "#FF6EB4" }, id: 27 }, { color: "hotpink 2 ", code: { hex: "#EE6AA7" }, id: 28 }, { color: "hotpink 3 ", code: { hex: "#CD6090" }, id: 29 }, { color: "hotpink 4 ", code: { hex: "#8B3A62" }, id: 30 }, { color: "raspberry ", code: { hex: "#872657" }, id: 31 }, { color: "deeppink 1 (deeppink) ", code: { hex: "#FF1493" }, id: 32 }, { color: "deeppink 2 ", code: { hex: "#EE1289" }, id: 33 }, { color: "deeppink 3 ", code: { hex: "#CD1076" }, id: 34 }, { color: "deeppink 4 ", code: { hex: "#8B0A50" }, id: 35 }, { color: "maroon 1 ", code: { hex: "#FF34B3" }, id: 36 }, { color: "maroon 2 ", code: { hex: "#EE30A7" }, id: 37 }, { color: "maroon 3 ", code: { hex: "#CD2990" }, id: 38 }, { color: "mediumvioletred", code: { hex: "#C71585" }, id: 39 }, { color: "violetred ", code: { hex: "#D02090" }, id: 40 }, { color: "orchid ", code: { hex: "#DA70D6" }, id: 41 }, { color: "orchid 1 ", code: { hex: "#FF83FA" }, id: 42 }, { color: "orchid 2 ", code: { hex: "#EE7AE9" }, id: 43 }, { color: "orchid 3 ", code: { hex: "#CD69C9" }, id: 44 }, { color: "orchid 4 ", code: { hex: "#8B4789" }, id: 45 }, { color: "thistle ", code: { hex: "#D8BFD8" }, id: 46 }, { color: "thistle 1 ", code: { hex: "#FFE1FF" }, id: 47 }, { color: "thistle 2 ", code: { hex: "#EED2EE" }, id: 48 }, { color: "thistle 3 ", code: { hex: "#CDB5CD" }, id: 49 }, { color: "thistle 4 ", code: { hex: "#8B7B8B" }, id: 50 }, { color: "plum 1 ", code: { hex: "#FFBBFF" }, id: 51 }, { color: "plum 2 ", code: { hex: "#EEAEEE" }, id: 52 }, { color: "plum 3 ", code: { hex: "#CD96CD" }, id: 53 }, { color: "plum 4 ", code: { hex: "#8B668B" }, id: 54 }, { color: "plum ", code: { hex: "#DDA0DD" }, id: 55 }, { color: "violet ", code: { hex: "#EE82EE" }, id: 56 }, { color: "magenta (fuchsia*) ", code: { hex: "#FF00FF" }, id: 57 }, { color: "magenta 2 ", code: { hex: "#EE00EE" }, id: 58 }, { color: "magenta 3 ", code: { hex: "#CD00CD" }, id: 59 }, { color: "magenta 4 (darkmagenta) ", code: { hex: "#8B008B" }, id: 60 }, { color: "purple* ", code: { hex: "#800080" }, id: 61 }, { color: "mediumorchid ", code: { hex: "#BA55D3" }, id: 62 }, { color: "mediumorchid 1 ", code: { hex: "#E066FF" }, id: 63 }, { color: "mediumorchid 2 ", code: { hex: "#D15FEE" }, id: 64 }, { color: "mediumorchid 3 ", code: { hex: "#B452CD" }, id: 65 }, { color: "mediumorchid 4 ", code: { hex: "#7A378B" }, id: 66 }, { color: "darkviolet ", code: { hex: "#9400D3" }, id: 67 }, { color: "darkorchid ", code: { hex: "#9932CC" }, id: 68 }, { color: "darkorchid 1 ", code: { hex: "#BF3EFF" }, id: 69 }, { color: "darkorchid 2 ", code: { hex: "#B23AEE" }, id: 70 }, { color: "darkorchid 3 ", code: { hex: "#9A32CD" }, id: 71 }, { color: "darkorchid 4 ", code: { hex: "#68228B" }, id: 72 }, { color: "indigo ", code: { hex: "#4B0082" }, id: 73 }, { color: "blueviolet ", code: { hex: "#8A2BE2" }, id: 74 }, { color: "purple 1 ", code: { hex: "#9B30FF" }, id: 75 }, { color: "purple 2 ", code: { hex: "#912CEE" }, id: 76 }, { color: "purple 3 ", code: { hex: "#7D26CD" }, id: 77 }, { color: "purple 4 ", code: { hex: "#551A8B" }, id: 78 }, { color: "mediumpurple ", code: { hex: "#9370DB" }, id: 79 }, { color: "mediumpurple 1 ", code: { hex: "#AB82FF" }, id: 80 }, { color: "mediumpurple 2 ", code: { hex: "#9F79EE" }, id: 81 }, { color: "mediumpurple 3 ", code: { hex: "#8968CD" }, id: 82 }, { color: "mediumpurple 4 ", code: { hex: "#5D478B" }, id: 83 }, { color: "darkslateblue ", code: { hex: "#483D8B" }, id: 84 }, { color: "lightslateblue ", code: { hex: "#8470FF" }, id: 85 }, { color: "mediumslateblue ", code: { hex: "#7B68EE" }, id: 86 }, { color: "slateblue ", code: { hex: "#6A5ACD" }, id: 87 }, { color: "slateblue 1 ", code: { hex: "#836FFF" }, id: 88 }, { color: "slateblue 2 ", code: { hex: "#7A67EE" }, id: 89 }, { color: "slateblue 3 ", code: { hex: "#6959CD" }, id: 90 }, { color: "slateblue 4 ", code: { hex: "#473C8B" }, id: 91 }, { color: "ghostwhite ", code: { hex: "#F8F8FF" }, id: 92 }, { color: "lavender ", code: { hex: "#E6E6FA" }, id: 93 }, { color: "blue* ", code: { hex: "#0000FF" }, id: 94 }, { color: "blue 2 ", code: { hex: "#0000EE" }, id: 95 }, { color: "blue 3 (mediumblue) ", code: { hex: "#0000CD" }, id: 96 }, { color: "blue 4 (darkblue) ", code: { hex: "#00008B" }, id: 97 }, { color: "navy* ", code: { hex: "#000080" }, id: 98 }, { color: "midnightblue ", code: { hex: "#191970" }, id: 99 }, { color: "cobalt ", code: { hex: "#3D59AB" }, id: 100 }, { color: "royalblue ", code: { hex: "#4169E1" }, id: 101 }, { color: "royalblue 1 ", code: { hex: "#4876FF" }, id: 102 }, { color: "royalblue 2 ", code: { hex: "#436EEE" }, id: 103 }, { color: "royalblue 3 ", code: { hex: "#3A5FCD" }, id: 104 }, { color: "royalblue 4 ", code: { hex: "#27408B" }, id: 105 }, { color: "cornflowerblue ", code: { hex: "#6495ED" }, id: 106 }, { color: "lightsteelblue ", code: { hex: "#B0C4DE" }, id: 107 }, { color: "lightsteelblue 1 ", code: { hex: "#CAE1FF" }, id: 108 }, { color: "lightsteelblue 2 ", code: { hex: "#BCD2EE" }, id: 109 }, { color: "lightsteelblue 3 ", code: { hex: "#A2B5CD" }, id: 110 }, { color: "lightsteelblue 4 ", code: { hex: "#6E7B8B" }, id: 111 }, { color: "lightslategray ", code: { hex: "#778899" }, id: 112 }, { color: "slategray ", code: { hex: "#708090" }, id: 113 }, { color: "slategray 1 ", code: { hex: "#C6E2FF" }, id: 114 }, { color: "slategray 2 ", code: { hex: "#B9D3EE" }, id: 115 }, { color: "slategray 3 ", code: { hex: "#9FB6CD" }, id: 116 }, { color: "slategray 4 ", code: { hex: "#6C7B8B" }, id: 117 }, { color: "dodgerblue 1 (dodgerblue)", code: { hex: "#1E90FF" }, id: 118 }, { color: "dodgerblue 2", code: { hex: "#1C86EE" }, id: 119 }, { color: "dodgerblue 3", code: { hex: "#1874CD" }, id: 120 }, { color: "dodgerblue 4", code: { hex: "#104E8B" }, id: 121 }, { color: "aliceblue", code: { hex: "#F0F8FF" }, id: 122 }, { color: "steelblue", code: { hex: "#4682B4" }, id: 123 }, { color: "steelblue 1", code: { hex: "#63B8FF" }, id: 124 }, { color: "steelblue 2", code: { hex: "#5CACEE" }, id: 125 }, { color: "steelblue 3", code: { hex: "#4F94CD" }, id: 126 }, { color: "steelblue 4", code: { hex: "#36648B" }, id: 127 }, { color: "lightskyblue", code: { hex: "#87CEFA" }, id: 128 }, { color: "lightskyblue 1", code: { hex: "#B0E2FF" }, id: 129 }, { color: "lightskyblue 2", code: { hex: "#A4D3EE" }, id: 130 }, { color: "lightskyblue 3", code: { hex: "#8DB6CD" }, id: 131 }, { color: "lightskyblue 4", code: { hex: "#607B8B" }, id: 132 }, { color: "skyblue 1", code: { hex: "#87CEFF" }, id: 133 }, { color: "skyblue 2", code: { hex: "#7EC0EE" }, id: 134 }, { color: "skyblue 3", code: { hex: "#6CA6CD" }, id: 135 }, { color: "skyblue 4", code: { hex: "#4A708B" }, id: 136 }, { color: "skyblue", code: { hex: "#87CEEB" }, id: 137 }, { color: "deepskyblue 1 (deepskyblue)", code: { hex: "#00BFFF" }, id: 138 }, { color: "deepskyblue 2", code: { hex: "#00B2EE" }, id: 139 }, { color: "deepskyblue 3", code: { hex: "#009ACD" }, id: 140 }, { color: "deepskyblue 4", code: { hex: "#00688B" }, id: 141 }, { color: "peacock", code: { hex: "#33A1C9" }, id: 142 }, { color: "lightblue", code: { hex: "#ADD8E6" }, id: 143 }, { color: "lightblue 1", code: { hex: "#BFEFFF" }, id: 144 }, { color: "lightblue 2", code: { hex: "#B2DFEE" }, id: 145 }, { color: "lightblue 3", code: { hex: "#9AC0CD" }, id: 146 }, { color: "lightblue 4", code: { hex: "#68838B" }, id: 147 }, { color: "powderblue", code: { hex: "#B0E0E6" }, id: 148 }, { color: "cadetblue 1", code: { hex: "#98F5FF" }, id: 149 }, { color: "cadetblue 2", code: { hex: "#8EE5EE" }, id: 150 }, { color: "cadetblue 3", code: { hex: "#7AC5CD" }, id: 151 }, { color: "cadetblue 4", code: { hex: "#53868B" }, id: 152 }, { color: "turquoise 1", code: { hex: "#00F5FF" }, id: 153 }, { color: "turquoise 2", code: { hex: "#00E5EE" }, id: 154 }, { color: "turquoise 3", code: { hex: "#00C5CD" }, id: 155 }, { color: "turquoise 4", code: { hex: "#00868B" }, id: 156 }, { color: "cadetblue", code: { hex: "#5F9EA0" }, id: 157 }, { color: "darkturquoise", code: { hex: "#00CED1" }, id: 158 }, { color: "azure 1 (azure)", code: { hex: "#F0FFFF" }, id: 159 }, { color: "azure 2", code: { hex: "#E0EEEE" }, id: 160 }, { color: "azure 3", code: { hex: "#C1CDCD" }, id: 161 }, { color: "azure 4", code: { hex: "#838B8B" }, id: 162 }, { color: "lightcyan 1 (lightcyan)", code: { hex: "#E0FFFF" }, id: 163 }, { color: "lightcyan 2", code: { hex: "#D1EEEE" }, id: 164 }, { color: "lightcyan 3", code: { hex: "#B4CDCD" }, id: 165 }, { color: "lightcyan 4", code: { hex: "#7A8B8B" }, id: 166 }, { color: "paleturquoise 1", code: { hex: "#BBFFFF" }, id: 167 }, { color: "paleturquoise 2 (paleturquoise)", code: { hex: "#AEEEEE" }, id: 168 }, { color: "paleturquoise 3", code: { hex: "#96CDCD" }, id: 169 }, { color: "paleturquoise 4", code: { hex: "#668B8B" }, id: 170 }, { color: "darkslategray", code: { hex: "#2F4F4F" }, id: 171 }, { color: "darkslategray 1", code: { hex: "#97FFFF" }, id: 172 }, { color: "darkslategray 2", code: { hex: "#8DEEEE" }, id: 173 }, { color: "darkslategray 3", code: { hex: "#79CDCD" }, id: 174 }, { color: "darkslategray 4", code: { hex: "#528B8B" }, id: 175 }, { color: "cyan / aqua*", code: { hex: "#00FFFF" }, id: 176 }, { color: "cyan 2", code: { hex: "#00EEEE" }, id: 177 }, { color: "cyan 3", code: { hex: "#00CDCD" }, id: 178 }, { color: "cyan 4 (darkcyan)", code: { hex: "#008B8B" }, id: 179 }, { color: "teal*", code: { hex: "#008080" }, id: 180 }, { color: "mediumturquoise", code: { hex: "#48D1CC" }, id: 181 }, { color: "lightseagreen", code: { hex: "#20B2AA" }, id: 182 }, { color: "manganeseblue", code: { hex: "#03A89E" }, id: 183 }, { color: "turquoise", code: { hex: "#40E0D0" }, id: 184 }, { color: "coldgrey", code: { hex: "#808A87" }, id: 185 }, { color: "turquoiseblue", code: { hex: "#00C78C" }, id: 186 }, { color: "aquamarine 1 (aquamarine)", code: { hex: "#7FFFD4" }, id: 187 }, { color: "aquamarine 2", code: { hex: "#76EEC6" }, id: 188 }, { color: "aquamarine 3 (mediumaquamarine)", code: { hex: "#66CDAA" }, id: 189 }, { color: "aquamarine 4", code: { hex: "#458B74" }, id: 190 }, { color: "mediumspringgreen", code: { hex: "#00FA9A" }, id: 191 }, { color: "mintcream", code: { hex: "#F5FFFA" }, id: 192 }, { color: "springgreen", code: { hex: "#00FF7F" }, id: 193 }, { color: "springgreen 1", code: { hex: "#00EE76" }, id: 194 }, { color: "springgreen 2", code: { hex: "#00CD66" }, id: 195 }, { color: "springgreen 3", code: { hex: "#008B45" }, id: 196 }, { color: "mediumseagreen", code: { hex: "#3CB371" }, id: 197 }, { color: "seagreen 1", code: { hex: "#54FF9F" }, id: 198 }, { color: "seagreen 2", code: { hex: "#4EEE94" }, id: 199 }, { color: "seagreen 3", code: { hex: "#43CD80" }, id: 200 }, { color: "seagreen 4 (seagreen)", code: { hex: "#2E8B57" }, id: 201 }, { color: "emeraldgreen", code: { hex: "#00C957" }, id: 202 }, { color: "mint", code: { hex: "#BDFCC9" }, id: 203 }, { color: "cobaltgreen", code: { hex: "#3D9140" }, id: 204 }, { color: "honeydew 1 (honeydew)", code: { hex: "#F0FFF0" }, id: 205 }, { color: "honeydew 2", code: { hex: "#E0EEE0" }, id: 206 }, { color: "honeydew 3", code: { hex: "#C1CDC1" }, id: 207 }, { color: "honeydew 4", code: { hex: "#838B83" }, id: 208 }, { color: "darkseagreen", code: { hex: "#8FBC8F" }, id: 209 }, { color: "darkseagreen 1", code: { hex: "#C1FFC1" }, id: 210 }, { color: "darkseagreen 2", code: { hex: "#B4EEB4" }, id: 211 }, { color: "darkseagreen 3", code: { hex: "#9BCD9B" }, id: 212 }, { color: "darkseagreen 4", code: { hex: "#698B69" }, id: 213 }, { color: "palegreen", code: { hex: "#98FB98" }, id: 214 }, { color: "palegreen 1", code: { hex: "#9AFF9A" }, id: 215 }, { color: "palegreen 2 (lightgreen)", code: { hex: "#90EE90" }, id: 216 }, { color: "palegreen 3", code: { hex: "#7CCD7C" }, id: 217 }, { color: "palegreen 4", code: { hex: "#548B54" }, id: 218 }, { color: "limegreen", code: { hex: "#32CD32" }, id: 219 }, { color: "forestgreen", code: { hex: "#228B22" }, id: 220 }, { color: "green 1 (lime*)", code: { hex: "#00FF00" }, id: 221 }, { color: "green 2", code: { hex: "#00EE00" }, id: 222 }, { color: "green 3", code: { hex: "#00CD00" }, id: 223 }, { color: "green 4", code: { hex: "#008B00" }, id: 224 }, { color: "green*", code: { hex: "#008000" }, id: 225 }, { color: "darkgreen", code: { hex: "#006400" }, id: 226 }, { color: "sapgreen", code: { hex: "#308014" }, id: 227 }, { color: "lawngreen", code: { hex: "#7CFC00" }, id: 228 }, { color: "chartreuse 1 (chartreuse)", code: { hex: "#7FFF00" }, id: 229 }, { color: "chartreuse 2", code: { hex: "#76EE00" }, id: 230 }, { color: "chartreuse 3", code: { hex: "#66CD00" }, id: 231 }, { color: "chartreuse 4", code: { hex: "#458B00" }, id: 232 }, { color: "greenyellow", code: { hex: "#ADFF2F" }, id: 233 }, { color: "darkolivegreen 1", code: { hex: "#CAFF70" }, id: 234 }, { color: "darkolivegreen 2", code: { hex: "#BCEE68" }, id: 235 }, { color: "darkolivegreen 3", code: { hex: "#A2CD5A" }, id: 236 }, { color: "darkolivegreen 4", code: { hex: "#6E8B3D" }, id: 237 }, { color: "darkolivegreen", code: { hex: "#556B2F" }, id: 238 }, { color: "olivedrab", code: { hex: "#6B8E23" }, id: 239 }, { color: "olivedrab 1", code: { hex: "#C0FF3E" }, id: 240 }, { color: "olivedrab 2", code: { hex: "#B3EE3A" }, id: 241 }, { color: "olivedrab 3 (yellowgreen)", code: { hex: "#9ACD32" }, id: 242 }, { color: "olivedrab 4", code: { hex: "#698B22" }, id: 243 }, { color: "ivory 1 (ivory)", code: { hex: "#FFFFF0" }, id: 244 }, { color: "ivory 2", code: { hex: "#EEEEE0" }, id: 245 }, { color: "ivory 3", code: { hex: "#CDCDC1" }, id: 246 }, { color: "ivory 4", code: { hex: "#8B8B83" }, id: 247 }, { color: "beige", code: { hex: "#F5F5DC" }, id: 248 }, { color: "lightyellow 1 (lightyellow)", code: { hex: "#FFFFE0" }, id: 249 }, { color: "lightyellow 2", code: { hex: "#EEEED1" }, id: 250 }, { color: "lightyellow 3", code: { hex: "#CDCDB4" }, id: 251 }, { color: "lightyellow 4", code: { hex: "#8B8B7A" }, id: 252 }, { color: "lightgoldenrodyellow", code: { hex: "#FAFAD2" }, id: 253 }, { color: "yellow 1 (yellow*)", code: { hex: "#FFFF00" }, id: 254 }, { color: "yellow 2", code: { hex: "#EEEE00" }, id: 255 }, { color: "yellow 3", code: { hex: "#CDCD00" }, id: 256 }, { color: "yellow 4", code: { hex: "#8B8B00" }, id: 257 }, { color: "warmgrey", code: { hex: "#808069" }, id: 258 }, { color: "olive*", code: { hex: "#808000" }, id: 259 }, { color: "darkkhaki", code: { hex: "#BDB76B" }, id: 260 }, { color: "khaki 1", code: { hex: "#FFF68F" }, id: 261 }, { color: "khaki 2", code: { hex: "#EEE685" }, id: 262 }, { color: "khaki 3", code: { hex: "#CDC673" }, id: 263 }, { color: "khaki 4", code: { hex: "#8B864E" }, id: 264 }, { color: "khaki", code: { hex: "#F0E68C" }, id: 265 }, { color: "palegoldenrod", code: { hex: "#EEE8AA" }, id: 266 }, { color: "lemonchiffon 1 (lemonchiffon)", code: { hex: "#FFFACD" }, id: 267 }, { color: "lemonchiffon 2", code: { hex: "#EEE9BF" }, id: 268 }, { color: "lemonchiffon 3", code: { hex: "#CDC9A5" }, id: 269 }, { color: "lemonchiffon 4", code: { hex: "#8B8970" }, id: 270 }, { color: "lightgoldenrod 1", code: { hex: "#FFEC8B" }, id: 271 }, { color: "lightgoldenrod 2", code: { hex: "#EEDC82" }, id: 272 }, { color: "lightgoldenrod 3", code: { hex: "#CDBE70" }, id: 273 }, { color: "lightgoldenrod 4", code: { hex: "#8B814C" }, id: 274 }, { color: "banana", code: { hex: "#E3CF57" }, id: 275 }, { color: "gold 1 (gold)", code: { hex: "#FFD700" }, id: 276 }, { color: "gold 2", code: { hex: "#EEC900" }, id: 277 }, { color: "gold 3", code: { hex: "#CDAD00" }, id: 278 }, { color: "gold 4", code: { hex: "#8B7500" }, id: 279 }, { color: "cornsilk 1 (cornsilk)", code: { hex: "#FFF8DC" }, id: 280 }, { color: "cornsilk 2", code: { hex: "#EEE8CD" }, id: 281 }, { color: "cornsilk 3", code: { hex: "#CDC8B1" }, id: 282 }, { color: "cornsilk 4", code: { hex: "#8B8878" }, id: 283 }, { color: "goldenrod", code: { hex: "#DAA520" }, id: 284 }, { color: "goldenrod 1", code: { hex: "#FFC125" }, id: 285 }, { color: "goldenrod 2", code: { hex: "#EEB422" }, id: 286 }, { color: "goldenrod 3", code: { hex: "#CD9B1D" }, id: 287 }, { color: "goldenrod 4", code: { hex: "#8B6914" }, id: 288 }, { color: "darkgoldenrod", code: { hex: "#B8860B" }, id: 289 }, { color: "darkgoldenrod 1", code: { hex: "#FFB90F" }, id: 290 }, { color: "darkgoldenrod 2", code: { hex: "#EEAD0E" }, id: 291 }, { color: "darkgoldenrod 3", code: { hex: "#CD950C" }, id: 292 }, { color: "darkgoldenrod 4", code: { hex: "#8B6508" }, id: 293 }, { color: "orange 1 (orange)", code: { hex: "#FFA500" }, id: 294 }, { color: "orange 2", code: { hex: "#EE9A00" }, id: 295 }, { color: "orange 3", code: { hex: "#CD8500" }, id: 296 }, { color: "orange 4", code: { hex: "#8B5A00" }, id: 297 }, { color: "floralwhite", code: { hex: "#FFFAF0" }, id: 298 }, { color: "oldlace", code: { hex: "#FDF5E6" }, id: 299 }, { color: "wheat", code: { hex: "#F5DEB3" }, id: 300 }, { color: "wheat 1", code: { hex: "#FFE7BA" }, id: 301 }, { color: "wheat 2", code: { hex: "#EED8AE" }, id: 302 }, { color: "wheat 3", code: { hex: "#CDBA96" }, id: 303 }, { color: "wheat 4", code: { hex: "#8B7E66" }, id: 304 }, { color: "moccasin", code: { hex: "#FFE4B5" }, id: 305 }, { color: "papayawhip", code: { hex: "#FFEFD5" }, id: 306 }, { color: "blanchedalmond", code: { hex: "#FFEBCD" }, id: 307 }, { color: "navajowhite 1 (navajowhite)", code: { hex: "#FFDEAD" }, id: 308 }, { color: "navajowhite 2", code: { hex: "#EECFA1" }, id: 309 }, { color: "navajowhite 3", code: { hex: "#CDB38B" }, id: 310 }, { color: "navajowhite 4", code: { hex: "#8B795E" }, id: 311 }, { color: "eggshell", code: { hex: "#FCE6C9" }, id: 312 }, { color: "tan", code: { hex: "#D2B48C" }, id: 313 }, { color: "brick", code: { hex: "#9C661F" }, id: 314 }, { color: "cadmiumyellow", code: { hex: "#FF9912" }, id: 315 }, { color: "antiquewhite", code: { hex: "#FAEBD7" }, id: 316 }, { color: "antiquewhite 1", code: { hex: "#FFEFDB" }, id: 317 }, { color: "antiquewhite 2", code: { hex: "#EEDFCC" }, id: 318 }, { color: "antiquewhite 3", code: { hex: "#CDC0B0" }, id: 319 }, { color: "antiquewhite 4", code: { hex: "#8B8378" }, id: 320 }, { color: "burlywood", code: { hex: "#DEB887" }, id: 321 }, { color: "burlywood 1", code: { hex: "#FFD39B" }, id: 322 }, { color: "burlywood 2", code: { hex: "#EEC591" }, id: 323 }, { color: "burlywood 3", code: { hex: "#CDAA7D" }, id: 324 }, { color: "burlywood 4", code: { hex: "#8B7355" }, id: 325 }, { color: "bisque 1 (bisque)", code: { hex: "#FFE4C4" }, id: 326 }, { color: "bisque 2", code: { hex: "#EED5B7" }, id: 327 }, { color: "bisque 3", code: { hex: "#CDB79E" }, id: 328 }, { color: "bisque 4", code: { hex: "#8B7D6B" }, id: 329 }, { color: "melon", code: { hex: "#E3A869" }, id: 330 }, { color: "carrot", code: { hex: "#ED9121" }, id: 331 }, { color: "darkorange", code: { hex: "#FF8C00" }, id: 332 }, { color: "darkorange 1", code: { hex: "#FF7F00" }, id: 333 }, { color: "darkorange 2", code: { hex: "#EE7600" }, id: 334 }, { color: "darkorange 3", code: { hex: "#CD6600" }, id: 335 }, { color: "darkorange 4", code: { hex: "#8B4500" }, id: 336 }, { color: "orange", code: { hex: "#FF8000" }, id: 337 }, { color: "tan 1", code: { hex: "#FFA54F" }, id: 338 }, { color: "tan 2", code: { hex: "#EE9A49" }, id: 339 }, { color: "tan 3 (peru)", code: { hex: "#CD853F" }, id: 340 }, { color: "tan 4", code: { hex: "#8B5A2B" }, id: 341 }, { color: "linen", code: { hex: "#FAF0E6" }, id: 342 }, { color: "peachpuff 1 (peachpuff)", code: { hex: "#FFDAB9" }, id: 343 }, { color: "peachpuff 2", code: { hex: "#EECBAD" }, id: 344 }, { color: "peachpuff 3", code: { hex: "#CDAF95" }, id: 345 }, { color: "peachpuff 4", code: { hex: "#8B7765" }, id: 346 }, { color: "seashell 1 (seashell)", code: { hex: "#FFF5EE" }, id: 347 }, { color: "seashell 2", code: { hex: "#EEE5DE" }, id: 348 }, { color: "seashell 3", code: { hex: "#CDC5BF" }, id: 349 }, { color: "seashell 4", code: { hex: "#8B8682" }, id: 350 }, { color: "sandybrown", code: { hex: "#F4A460" }, id: 351 }, { color: "rawsienna", code: { hex: "#C76114" }, id: 352 }, { color: "chocolate", code: { hex: "#D2691E" }, id: 353 }, { color: "chocolate 1", code: { hex: "#FF7F24" }, id: 354 }, { color: "chocolate 2", code: { hex: "#EE7621" }, id: 355 }, { color: "chocolate 3", code: { hex: "#CD661D" }, id: 356 }, { color: "chocolate 4 (saddlebrown)", code: { hex: "#8B4513" }, id: 357 }, { color: "ivoryblack", code: { hex: "#292421" }, id: 358 }, { color: "flesh", code: { hex: "#FF7D40" }, id: 359 }, { color: "cadmiumorange", code: { hex: "#FF6103" }, id: 360 }, { color: "burntsienna", code: { hex: "#8A360F" }, id: 361 }, { color: "sienna", code: { hex: "#A0522D" }, id: 362 }, { color: "sienna 1", code: { hex: "#FF8247" }, id: 363 }, { color: "sienna 2", code: { hex: "#EE7942" }, id: 364 }, { color: "sienna 3", code: { hex: "#CD6839" }, id: 365 }, { color: "sienna 4", code: { hex: "#8B4726" }, id: 366 }, { color: "lightsalmon 1 (lightsalmon)", code: { hex: "#FFA07A" }, id: 367 }, { color: "lightsalmon 2", code: { hex: "#EE9572" }, id: 368 }, { color: "lightsalmon 3", code: { hex: "#CD8162" }, id: 369 }, { color: "lightsalmon 4", code: { hex: "#8B5742" }, id: 370 }, { color: "coral", code: { hex: "#FF7F50" }, id: 371 }, { color: "orangered 1 (orangered)", code: { hex: "#FF4500" }, id: 372 }, { color: "orangered 2", code: { hex: "#EE4000" }, id: 373 }, { color: "orangered 3", code: { hex: "#CD3700" }, id: 374 }, { color: "orangered 4", code: { hex: "#8B2500" }, id: 375 }, { color: "sepia", code: { hex: "#5E2612" }, id: 376 }, { color: "darksalmon", code: { hex: "#E9967A" }, id: 377 }, { color: "salmon 1", code: { hex: "#FF8C69" }, id: 378 }, { color: "salmon 2", code: { hex: "#EE8262" }, id: 379 }, { color: "salmon 3", code: { hex: "#CD7054" }, id: 380 }, { color: "salmon 4", code: { hex: "#8B4C39" }, id: 381 }, { color: "coral 1", code: { hex: "#FF7256" }, id: 382 }, { color: "coral 2", code: { hex: "#EE6A50" }, id: 383 }, { color: "coral 3", code: { hex: "#CD5B45" }, id: 384 }, { color: "coral 4", code: { hex: "#8B3E2F" }, id: 385 }, { color: "burntumber", code: { hex: "#8A3324" }, id: 386 }, { color: "tomato 1 (tomato)", code: { hex: "#FF6347" }, id: 387 }, { color: "tomato 2", code: { hex: "#EE5C42" }, id: 388 }, { color: "tomato 3", code: { hex: "#CD4F39" }, id: 389 }, { color: "tomato 4", code: { hex: "#8B3626" }, id: 390 }, { color: "salmon", code: { hex: "#FA8072" }, id: 391 }, { color: "mistyrose 1 (mistyrose)", code: { hex: "#FFE4E1" }, id: 392 }, { color: "mistyrose 2", code: { hex: "#EED5D2" }, id: 393 }, { color: "mistyrose 3", code: { hex: "#CDB7B5" }, id: 394 }, { color: "mistyrose 4", code: { hex: "#8B7D7B" }, id: 395 }, { color: "snow 1 (snow)", code: { hex: "#FFFAFA" }, id: 396 }, { color: "snow 2", code: { hex: "#EEE9E9" }, id: 397 }, { color: "snow 3", code: { hex: "#CDC9C9" }, id: 398 }, { color: "snow 4", code: { hex: "#8B8989" }, id: 399 }, { color: "rosybrown", code: { hex: "#BC8F8F" }, id: 400 }, { color: "rosybrown 1", code: { hex: "#FFC1C1" }, id: 401 }, { color: "rosybrown 2", code: { hex: "#EEB4B4" }, id: 402 }, { color: "rosybrown 3", code: { hex: "#CD9B9B" }, id: 403 }, { color: "rosybrown 4", code: { hex: "#8B6969" }, id: 404 }, { color: "lightcoral", code: { hex: "#F08080" }, id: 405 }, { color: "indianred", code: { hex: "#CD5C5C" }, id: 406 }, { color: "indianred 1", code: { hex: "#FF6A6A" }, id: 407 }, { color: "indianred 2", code: { hex: "#EE6363" }, id: 408 }, { color: "indianred 4", code: { hex: "#8B3A3A" }, id: 409 }, { color: "indianred 3", code: { hex: "#CD5555" }, id: 410 }, { color: "brown", code: { hex: "#A52A2A" }, id: 411 }, { color: "brown 1", code: { hex: "#FF4040" }, id: 412 }, { color: "brown 2", code: { hex: "#EE3B3B" }, id: 413 }, { color: "brown 3", code: { hex: "#CD3333" }, id: 414 }, { color: "brown 4", code: { hex: "#8B2323" }, id: 415 }, { color: "firebrick", code: { hex: "#B22222" }, id: 416 }, { color: "firebrick 1", code: { hex: "#FF3030" }, id: 417 }, { color: "firebrick 2", code: { hex: "#EE2C2C" }, id: 418 }, { color: "firebrick 3", code: { hex: "#CD2626" }, id: 419 }, { color: "firebrick 4", code: { hex: "#8B1A1A" }, id: 420 }, { color: "red 1 (red*)", code: { hex: "#FF0000" }, id: 421 }, { color: "red 2", code: { hex: "#EE0000" }, id: 422 }, { color: "red 3", code: { hex: "#CD0000" }, id: 423 }, { color: "red 4 (darkred)", code: { hex: "#8B0000" }, id: 424 }, { color: "maroon*", code: { hex: "#800000" }, id: 425 }, { color: "sgi beet", code: { hex: "#8E388E" }, id: 426 }, { color: "sgi slateblue", code: { hex: "#7171C6" }, id: 427 }, { color: "sgi lightblue", code: { hex: "#7D9EC0" }, id: 428 }, { color: "sgi teal", code: { hex: "#388E8E" }, id: 429 }, { color: "sgi chartreuse", code: { hex: "#71C671" }, id: 430 }, { color: "sgi olivedrab", code: { hex: "#8E8E38" }, id: 431 }, { color: "sgi brightgray", code: { hex: "#C5C1AA" }, id: 432 }, { color: "sgi salmon", code: { hex: "#C67171" }, id: 433 }, { color: "sgi darkgray", code: { hex: "#555555" }, id: 434 }, { color: "sgi gray 12", code: { hex: "#1E1E1E" }, id: 435 }, { color: "sgi gray 16", code: { hex: "#282828" }, id: 436 }, { color: "sgi gray 32", code: { hex: "#515151" }, id: 437 }, { color: "sgi gray 36", code: { hex: "#5B5B5B" }, id: 438 }, { color: "sgi gray 52", code: { hex: "#848484" }, id: 439 }, { color: "sgi gray 56", code: { hex: "#8E8E8E" }, id: 440 }, { color: "sgi lightgray", code: { hex: "#AAAAAA" }, id: 441 }, { color: "sgi gray 72", code: { hex: "#B7B7B7" }, id: 442 }, { color: "sgi gray 76", code: { hex: "#C1C1C1" }, id: 443 }, { color: "sgi gray 92", code: { hex: "#EAEAEA" }, id: 444 }, { color: "sgi gray 96", code: { hex: "#F4F4F4" }, id: 445 }, { color: "white*", code: { hex: "#FFFFFF" }, id: 446 }, { color: "white smoke (gray 96)", code: { hex: "#F5F5F5" }, id: 447 }, { color: "gainsboro", code: { hex: "#DCDCDC" }, id: 448 }, { color: "lightgrey", code: { hex: "#D3D3D3" }, id: 449 }, { color: "silver*", code: { hex: "#C0C0C0" }, id: 450 }, { color: "darkgray", code: { hex: "#A9A9A9" }, id: 451 }, { color: "gray*", code: { hex: "#808080" }, id: 452 }, { color: "dimgray (gray 42)", code: { hex: "#696969" }, id: 453 }, { color: "black*", code: { hex: "#000000" }, id: 454 }, { color: "gray 99", code: { hex: "#FCFCFC" }, id: 455 }, { color: "gray 98", code: { hex: "#FAFAFA" }, id: 456 }, { color: "gray 97", code: { hex: "#F7F7F7" }, id: 457 }, { color: "white smoke (gray 96)", code: { hex: "#F5F5F5" }, id: 458 }, { color: "gray 95", code: { hex: "#F2F2F2" }, id: 459 }, { color: "gray 94", code: { hex: "#F0F0F0" }, id: 460 }, { color: "gray 93", code: { hex: "#EDEDED" }, id: 461 }, { color: "gray 92", code: { hex: "#EBEBEB" }, id: 462 }, { color: "gray 91", code: { hex: "#E8E8E8" }, id: 463 }, { color: "gray 90", code: { hex: "#E5E5E5" }, id: 464 }, { color: "gray 89", code: { hex: "#E3E3E3" }, id: 465 }, { color: "gray 88", code: { hex: "#E0E0E0" }, id: 466 }, { color: "gray 87", code: { hex: "#DEDEDE" }, id: 467 }, { color: "gray 86", code: { hex: "#DBDBDB" }, id: 468 }, { color: "gray 85", code: { hex: "#D9D9D9" }, id: 469 }, { color: "gray 84", code: { hex: "#D6D6D6" }, id: 470 }, { color: "gray 83", code: { hex: "#D4D4D4" }, id: 471 }, { color: "gray 82", code: { hex: "#D1D1D1" }, id: 472 }, { color: "gray 81", code: { hex: "#CFCFCF" }, id: 473 }, { color: "gray 80", code: { hex: "#CCCCCC" }, id: 474 }, { color: "gray 79", code: { hex: "#C9C9C9" }, id: 475 }, { color: "gray 78", code: { hex: "#C7C7C7" }, id: 476 }, { color: "gray 77", code: { hex: "#C4C4C4" }, id: 477 }, { color: "gray 76", code: { hex: "#C2C2C2" }, id: 478 }, { color: "gray 75", code: { hex: "#BFBFBF" }, id: 479 }, { color: "gray 74", code: { hex: "#BDBDBD" }, id: 480 }, { color: "gray 73", code: { hex: "#BABABA" }, id: 481 }, { color: "gray 72", code: { hex: "#B8B8B8" }, id: 482 }, { color: "gray 71", code: { hex: "#B5B5B5" }, id: 483 }, { color: "gray 70", code: { hex: "#B3B3B3" }, id: 484 }, { color: "gray 69", code: { hex: "#B0B0B0" }, id: 485 }, { color: "gray 68", code: { hex: "#ADADAD" }, id: 486 }, { color: "gray 67", code: { hex: "#ABABAB" }, id: 487 }, { color: "gray 66", code: { hex: "#A8A8A8" }, id: 488 }, { color: "gray 65", code: { hex: "#A6A6A6" }, id: 489 }, { color: "gray 64", code: { hex: "#A3A3A3" }, id: 490 }, { color: "gray 63", code: { hex: "#A1A1A1" }, id: 491 }, { color: "gray 62", code: { hex: "#9E9E9E" }, id: 492 }, { color: "gray 61", code: { hex: "#9C9C9C" }, id: 493 }, { color: "gray 60", code: { hex: "#999999" }, id: 494 }, { color: "gray 59", code: { hex: "#969696" }, id: 495 }, { color: "gray 58", code: { hex: "#949494" }, id: 496 }, { color: "gray 57", code: { hex: "#919191" }, id: 497 }, { color: "gray 56", code: { hex: "#8F8F8F" }, id: 498 }, { color: "gray 55", code: { hex: "#8C8C8C" }, id: 499 }, { color: "gray 54", code: { hex: "#8A8A8A" }, id: 500 }, { color: "gray 53", code: { hex: "#878787" }, id: 501 }, { color: "gray 52", code: { hex: "#858585" }, id: 502 }, { color: "gray 51", code: { hex: "#828282" }, id: 503 }, { color: "gray 50", code: { hex: "#7F7F7F" }, id: 504 }, { color: "gray 49", code: { hex: "#7D7D7D" }, id: 505 }, { color: "gray 48", code: { hex: "#7A7A7A" }, id: 506 }, { color: "gray 47", code: { hex: "#787878" }, id: 507 }, { color: "gray 46", code: { hex: "#757575" }, id: 508 }, { color: "gray 45", code: { hex: "#737373" }, id: 509 }, { color: "gray 44", code: { hex: "#707070" }, id: 510 }, { color: "gray 43", code: { hex: "#6E6E6E" }, id: 511 }, { color: "gray 42", code: { hex: "#6B6B6B" }, id: 512 }, { color: "dimgray (gray 42)", code: { hex: "#696969" }, id: 513 }, { color: "gray 40", code: { hex: "#666666" }, id: 514 }, { color: "gray 39", code: { hex: "#636363" }, id: 515 }, { color: "gray 38", code: { hex: "#616161" }, id: 516 }, { color: "gray 37", code: { hex: "#5E5E5E" }, id: 517 }, { color: "gray 36", code: { hex: "#5C5C5C" }, id: 518 }, { color: "gray 35", code: { hex: "#595959" }, id: 519 }, { color: "gray 34", code: { hex: "#575757" }, id: 520 }, { color: "gray 33", code: { hex: "#545454" }, id: 521 }, { color: "gray 32", code: { hex: "#525252" }, id: 522 }, { color: "gray 31", code: { hex: "#4F4F4F" }, id: 523 }, { color: "gray 30", code: { hex: "#4D4D4D" }, id: 524 }, { color: "gray 29", code: { hex: "#4A4A4A" }, id: 525 }, { color: "gray 28", code: { hex: "#474747" }, id: 526 }, { color: "gray 27", code: { hex: "#454545" }, id: 527 }, { color: "gray 26", code: { hex: "#424242" }, id: 528 }, { color: "gray 25", code: { hex: "#404040" }, id: 529 }, { color: "gray 24", code: { hex: "#3D3D3D" }, id: 530 }, { color: "gray 23", code: { hex: "#3B3B3B" }, id: 531 }, { color: "gray 22", code: { hex: "#383838" }, id: 532 }, { color: "gray 21", code: { hex: "#363636" }, id: 533 }, { color: "gray 20", code: { hex: "#333333" }, id: 534 }, { color: "gray 19", code: { hex: "#303030" }, id: 535 }, { color: "gray 18", code: { hex: "#2E2E2E" }, id: 536 }, { color: "gray 17", code: { hex: "#2B2B2B" }, id: 537 }, { color: "gray 16", code: { hex: "#292929" }, id: 538 }, { color: "gray 15", code: { hex: "#262626" }, id: 539 }, { color: "gray 14", code: { hex: "#242424" }, id: 540 }, { color: "gray 13", code: { hex: "#212121" }, id: 541 }, { color: "gray 12", code: { hex: "#1F1F1F" }, id: 542 }, { color: "gray 11", code: { hex: "#1C1C1C" }, id: 543 }, { color: "gray 10", code: { hex: "#1A1A1A" }, id: 544 }, { color: "gray 9", code: { hex: "#171717" }, id: 545 }, { color: "gray 8", code: { hex: "#141414" }, id: 546 }, { color: "gray 7", code: { hex: "#121212" }, id: 547 }, { color: "gray 6", code: { hex: "#0F0F0F" }, id: 548 }, { color: "gray 5", code: { hex: "#0D0D0D" }, id: 549 }, { color: "gray 4", code: { hex: "#0A0A0A" }, id: 550 }, { color: "gray 3", code: { hex: "#080808" }, id: 551 }, { color: "gray 2", code: { hex: "#050505" }, id: 552 }, { color: "gray 1", code: { hex: "#030303" }, id: 553 }];
  1600. let clr = hexCode.find(x => x.color.toLowerCase().trim() == colour.toLowerCase().trim());
  1601. let clr2 = hexCode.find(x => x.color.toLowerCase().trim().indexOf(colour) > 0);
  1602. if (typeof colours[colour.toLowerCase()]) {
  1603. return colours[colour.toLowerCase()];
  1604. }
  1605. else if (clr) {
  1606. return clr.code.hex;
  1607. }
  1608. else if (clr2) {
  1609. return clr2.code.hex;
  1610. }
  1611. else {
  1612. return false;
  1613. }
  1614. }
  1615. select2TooltipDataBinding() {
  1616. var instance = this;
  1617. var data = instance.selectedDatalistColumns();
  1618. $("#tooltip_select").off('select2:select').off('select2:unselect').off('select2:selecting');
  1619. $("#tooltip_select").select2({
  1620. placeholder: 'Select ToolTip columns',
  1621. data: data,
  1622. }).on('select2:select', function (e) {
  1623. let data = e.params.data;
  1624. let dataType = Number($("#allDatalistColumns #li_" + e.params.data.id + " span.datalist_column").attr('data-column-datatype'));
  1625. var sIndex = instance._reportBuilder.getIndexByAliasName_selectedColumnsArray(data.text);
  1626. if (sIndex == -1) {
  1627. var selCol = new SelectedColumns();
  1628. selCol.ColumnId = Number(data.id);
  1629. selCol.ColumnName = data.text;
  1630. selCol.DisplayText = data.text;
  1631. selCol.AliasName = data.text;
  1632. selCol.DataType = dataType;
  1633. selCol.Isvisible = true;
  1634. instance._reportBuilder._selectedColumns(selCol);
  1635. }
  1636. var tIndex = instance.getIndexByDisplayText_tooltipColumnsArray(data.text);
  1637. if (tIndex == -1) {
  1638. instance.toolTipArray.push({ ColumnId: Number(data.id), ColumnName: data.text, DisplayText: data.text, AliasName: data.text });
  1639. }
  1640. instance.ChartSelectedColumns = instance.coordinate_Elements(true, true, true, true, true, true);
  1641. instance.chartData();
  1642. var html = instance._reportBuilderTemplate.loadToolTipColumn(Number(data.id), data.text, dataType, data.text);
  1643. $("#tab_tooltip #tooltip_selected_columns").append(html);
  1644. instance._reportBuilder.setSelectOption("tooltip_select");
  1645. });
  1646. }
  1647. bindChartBaseColumnSelect2() {
  1648. var data = this.selectedDatalistColumns();
  1649. $("#base_column_select").off('select2:select').off('select2:unselect').off('select2:selecting');
  1650. $("#base_column_select").select2({
  1651. placeholder: 'Select Base Column',
  1652. data: data,
  1653. }).on('select2:select', (e) => {
  1654. let data = e.params.data;
  1655. let dataType = Number($("#allDatalistColumns #li_" + e.params.data.id + " span.datalist_column").attr('data-column-datatype'));
  1656. var sIndex = this.getIndexByAliasName_ChartSelectedColumns(data.text);
  1657. if (sIndex == -1) {
  1658. var selCol = new SelectedColumns();
  1659. selCol.ColumnId = Number(data.id);
  1660. selCol.ColumnName = data.text;
  1661. selCol.DisplayText = data.text;
  1662. selCol.AliasName = data.text;
  1663. selCol.DataType = dataType;
  1664. selCol.Isvisible = true;
  1665. this._reportBuilder._selectedColumns(selCol);
  1666. }
  1667. var tIndex = this.getIndexByDisplayText_BaseColumnsArray(data.text);
  1668. if (tIndex == -1) {
  1669. this.chartBaseColumns.push({ ColumnId: Number(data.id), ColumnName: data.text, DisplayText: data.text, AliasName: data.text });
  1670. }
  1671. this.ChartSelectedColumns = this.coordinate_Elements(true, true, true, true, true, true);
  1672. this.chartData();
  1673. var html = this._reportBuilderTemplate.loadSelect2Column(Number(data.id), data.text, dataType);
  1674. $("#base_column #base_column_selected_columns").append(html);
  1675. this._reportBuilder.setSelectOption("base_column_select");
  1676. });
  1677. }
  1678. loadToolTipRightNav() {
  1679. var instance = this;
  1680. let html = `<div class="bg-white card"> <div class="card-header"><span>Tool Tip</span><button class="btn btn-icon btn-icon-circle btn-icon-style-3 ChartToolTipForm" id="Chart_ToolTip"><i class="fa fa-comment"></i></button></div><div class="card-body pl-2 pr-2 rightnav_body"> <ul id="ultooltips"> </ul> </div> </div>`;
  1681. $("#bl-nav-right-tooltip").html(html);
  1682. instance.loadSelectedColumnsInToolTip_RightNav();
  1683. }
  1684. loadSelectedColumnsInToolTip_RightNav() {
  1685. var instance = this;
  1686. let html = "";
  1687. for (var i = 0; i < instance._reportBuilder.datalistColumnsResponseData.length; i++) {
  1688. var datalistcolumn = instance._reportBuilder.datalistColumnsResponseData[i];
  1689. let checked = "";
  1690. let disabled = "disabled";
  1691. let Index = instance.getindexByTooltipArray(datalistcolumn.ColumnId);
  1692. let displayText = datalistcolumn.ColumnName;
  1693. if (Index != -1) {
  1694. displayText = instance.toolTipArray[Index].DisplayText;
  1695. checked = "checked";
  1696. disabled = "";
  1697. }
  1698. html += `<li class="list-group-item pl-2 pr-2" id="li_tooltip_` + datalistcolumn.ColumnId + `"><div class="btn-group pull-right" style="margin-top:-8px" id="divtooltip_` + datalistcolumn.ColumnId + `"><a class="btn pl-1 pr-1 ` + disabled + `" id="btnEditName" onclick="Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().showTooltipEditMode(` + datalistcolumn.ColumnId + `)"><span><i class="fa fa-pencil"></i></span></a><span class="btn pl-1 pr-1"><input type="checkbox" class="chktooltips" ` + checked + ` onclick="Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().toolTipCheckBox(` + datalistcolumn.ColumnId + `,'` + datalistcolumn.ColumnName + `')" id="tooltip_checkbox"></span></div><div id="divcolumnname_` + datalistcolumn.ColumnId + `" class="col-sm-9 pl-1 pr-1 input-icons"><span id="tooltipcolumnname"> ` + displayText + ` </span> <input id="tooltipcolumnname_displaytext" class="hidden col-sm-12 form-control" value="` + displayText + `"> <span id="closebutton_tooltip" onclick="Unibase.Platform.Analytics.Charts.ChartBuilder.Instance().closeTooltipEditMode(` + datalistcolumn.ColumnId + `,'` + datalistcolumn.ColumnName + `')" class="fa fa-close font-15 mr-10 field-icon hidden"></span> </div></li>`;
  1699. }
  1700. $("#ultooltips").html(html);
  1701. }
  1702. removeSelectedToolTip(AliasName) {
  1703. var instance = this;
  1704. $("#tooltip_selected_columns #dsl_tool_column_" + AliasName).remove();
  1705. var tIndex = instance.getIndexByDisplayText_tooltipColumnsArray(AliasName);
  1706. var cIdx = instance.getIndexByAliasName_ChartSelectedColumns(AliasName);
  1707. if (tIndex > -1)
  1708. instance.toolTipArray.splice(tIndex, 1);
  1709. if (cIdx > -1)
  1710. instance.ChartSelectedColumns[cIdx].IsToolTip = false;
  1711. }
  1712. toolTipEdit(AliasName) {
  1713. var instance = this;
  1714. var tIndex = instance.getIndexByDisplayText_tooltipColumnsArray(AliasName);
  1715. var sIndex = instance._reportBuilder.getIndexByColumnName_selectedColumnsArray(AliasName);
  1716. var toolTipName = $("#dsl_tool_column_" + AliasName + " #txttooltipedit").val();
  1717. if (tIndex > -1 && sIndex > -1) {
  1718. instance.toolTipArray[tIndex].DisplayText = toolTipName;
  1719. instance._reportBuilder.selectedColumns[sIndex].DisplayText = toolTipName;
  1720. instance.isColumnRename = true;
  1721. }
  1722. instance.chartData();
  1723. }
  1724. loadCategoriesSelect2() {
  1725. var instance = this;
  1726. var data;
  1727. $("#categories_select").off('select2:select').off('select2:unselect').empty();
  1728. data = instance._reportBuilder.getSelectedColumns_Select2_Data();
  1729. $("#categories_select").select2({
  1730. placeholder: 'Select categories columns',
  1731. data: data,
  1732. }).on('select2:select', function (e) {
  1733. let data = e.params.data;
  1734. let dataType = Number($("#allDatalistColumns #li_" + e.params.data.id + " span.datalist_column").attr('data-column-datatype'));
  1735. let Index = instance._reportBuilder.getIndexByColumnName_selectedColumnsArray(data.text);
  1736. if (Index != -1) {
  1737. var sel_col = instance._reportBuilder.selectedColumns[Index];
  1738. if (sel_col)
  1739. var catCol = sel_col.GroupByCategory;
  1740. if (!catCol) {
  1741. if (Index != -1) {
  1742. instance._reportBuilder.selectedColumns[Index].GroupByCategory = true;
  1743. }
  1744. else {
  1745. var selCol = new SelectedColumns();
  1746. selCol.ColumnId = parseInt(data.id);
  1747. selCol.ColumnName = data.text;
  1748. selCol.ColumnIndex = instance._reportBuilder.selectedColumns.length;
  1749. selCol.DataType = dataType;
  1750. selCol.Isvisible = true;
  1751. selCol.GroupBy = false;
  1752. selCol.AliasName = data.text;
  1753. selCol.DisplayText = data.text;
  1754. selCol.GroupByCategory = true;
  1755. instance._reportBuilder._selectedColumns(selCol);
  1756. }
  1757. instance._reportBuilder.Categories = $('#categories_select').select2('data');
  1758. var html = instance._reportBuilderTemplate.loadSelect2Column(Number(e.params.data.id), e.params.data.text, dataType);
  1759. $("#categories_selected_columns").append(html);
  1760. instance._reportBuilder.setSelectOption("categories_select");
  1761. $(".dsl_column_filters").addClass('hidden');
  1762. instance._reportBuilder.stringifyed_SortColumns = instance._reportBuilder.getSortColumnsStringify();
  1763. instance._reportBuilder.load_data(instance._reportBuilder.table);
  1764. }
  1765. else {
  1766. instance._reportBuilder.setSelectOption("categories_select");
  1767. $("#categories_select").select2('close').val("");
  1768. alert("Column - " + data.text + " already exists in categories select2. Please change display text and try again");
  1769. return false;
  1770. }
  1771. }
  1772. });
  1773. }
  1774. sortTooltipColumnsEvent() {
  1775. var tooltipContainer = $("#tooltip_selected_columns");
  1776. if (!tooltipContainer)
  1777. return;
  1778. $("#tooltip_selected_columns").sortable({
  1779. connectWith: "#tooltip_selected_columns",
  1780. cursor: 'move',
  1781. update: (event, ui) => {
  1782. var tooltipColumnElements = $(event.target).children();
  1783. tooltipColumnElements.each((index, ele) => {
  1784. let aliasName = ele.id.replace("dsl_tool_column_", "");
  1785. let colIdx = this.toolTipArray.findIndex(x => x.AliasName == aliasName);
  1786. if (colIdx > -1) {
  1787. this.changeIndexOfElementsInArray(this.toolTipArray, colIdx, index);
  1788. }
  1789. });
  1790. }
  1791. });
  1792. }
  1793. changeIndexOfElementsInArray(arr, fromIndex, toIndex) {
  1794. let element = arr[fromIndex];
  1795. arr.splice(fromIndex, 1);
  1796. arr.splice(toIndex, 0, element);
  1797. }
  1798. updateshowTooltipTitleProp(showTooltip) {
  1799. $("#showtooltipheader_checkbox").prop("checked", showTooltip);
  1800. }
  1801. updateIsDataLabelProp(isDataLabel) {
  1802. $("#isdatalabel").prop("checked", isDataLabel);
  1803. }
  1804. isNumberAbbreviation(axis) {
  1805. const instance = this;
  1806. if (axis) {
  1807. const axisProperty = axis === 'x' ? 'IsXaxis' : 'IsYaxis';
  1808. const isChecked = $(`#IsNumberAbbrevation_${axis}`).prop("checked");
  1809. for (const column of instance._chartBuilder.ChartSelectedColumns) {
  1810. if (column[axisProperty]) {
  1811. column.IsNumAbb = isChecked;
  1812. }
  1813. }
  1814. }
  1815. }
  1816. static Instance() {
  1817. if (this.instance === undefined) {
  1818. this.instance = new ChartBuilder();
  1819. }
  1820. return this.instance;
  1821. }
  1822. }
  1823. Charts.ChartBuilder = ChartBuilder;
  1824. })(Charts = Analytics.Charts || (Analytics.Charts = {}));
  1825. })(Analytics = Platform.Analytics || (Platform.Analytics = {}));
  1826. })(Platform = Unibase.Platform || (Unibase.Platform = {}));
  1827. })(Unibase || (Unibase = {}));