Ignite UI export large dataset halts the page - javascript

The version I'm using is 15.2. Previously I have been having no problems downloading a small dataset into Excel. However, for the current page, the data set is slightly larger than usual (280 rows x 14 columns). Every time I click the export button the page will halt (no Excel is generated after waiting for a min+). Does anyone have similar experience like this before and how to work around it?
Here's a snippet of the export function
$('#exportButton')
.on({
click: function() {
var fileName = getExportFileNameForSingleDate("NAV_Comparison");
$.ig.GridExcelExporter.exportGrid($("#grid"),
{
fileName: fileName,
tableStyle: 'tableStyleLight13'
},
{
exportStarting: function(e, args) {
showExportingIndicator(args.grid, exportingIndicator);
},
success: function() {
hideExportingIndicator(exportingIndicator);
}
});
}
});
function showExportingIndicator(grid, exportingIndicator) {
exportingIndicator.css({
"width": grid.outerWidth(),
"height": grid.outerHeight()
})
.html('<span class="exporting-text">Processing...</span>');
exportingIndicator.addClass("exporting-indicator");
grid.append(exportingIndicator);
}
function hideExportingIndicator(exportingIndicator) {
exportingIndicator.remove();
}

Have you upgraded your product to a higher version ? Supporting hierarchical data exporting was introduced in 16.1 and this definitely slowed down exporting,though in latest versions this performance issue was handled and as you can see in this example (http://jsfiddle.net/8unab211/1/)exporting 2500 records x 12 columns seems pretty fine. I can have a further look if you specify the exact version used and provide a sample chunk of your data:
$.ig.GridExcelExporter.exportGrid($("#grid1"), {
fileName: "igGrid",
gridFeatureOptions: {
paging: "allRows",
},
});

Related

Unexpected error when attempting to update chart data in Chart.js, in a Vue app

I am using Chart.js 3.5 and Vue 3.
I was successfully able to draw a chart, and I am trying to trigger a data change, inside a Vue method. Unfortunately, I encounter the following issue: "Uncaught TypeError: Cannot set property 'fullSize' of undefined".
Edit2: Added a missed }. Code should now be runnable
MyChart.vue:
<template>
<canvas id="chartEl" width="400" height="400" ref="chartEl"></canvas>
<button #click="addData">Update Chart</button>
</template>
<script>
import Chart from 'chart.js/auto';
export default {
name: "Raw",
data() {
return {
chart: null
}
},
methods: {
createChart() {
this.chart= new Chart(this.$refs["chartEl"], {
type: 'doughnut',
data: {
labels: ['VueJs', 'EmberJs', 'ReactJs', 'AngularJs'],
datasets: [
{
backgroundColor: [
'#41B883',
'#E46651',
'#00D8FF',
'#DD1B16'
],
data: [100, 20, 80, 20]
}
]
},
options: {
plugins: {}
}
})
},
addData() {
const data = this.chart.data;
if (data.datasets.length > 0) {
data.labels.push('data #' + (data.labels.length + 1));
for (var index = 0; index < data.datasets.length; ++index) {
data.datasets[index].data.push(123);
}
// Edit2: added missed }
this.chart.update(); } // this line seems to cause the error}
}
},
mounted () {
this.createChart()
},
}
</script>
Edit1: Adding the following to the options makes the chart update successfully, but the error is still present and the animation does not work. The chart flickers and displays the final (updated) state. Other animations, such as hiding/showing arcs do not seem to be afected
options: {
responsive: true,
}
Edit3: Adding "maintainAspectRatio:false" option seems to again stop chart from updating (the above mentioned error is still present)
By walking through the debugger, the following function from 'chart.esm.js' seems to be called successfully a few times, and then error out on last call:
beforeUpdate(chart, _args, options) {
const title = map.get(chart); // this returns null, which will cause the next call to error with the above mentioned exception.
layouts.configure(chart, title, options);
title.options = options;
},
//////////////////////
configure(chart, item, options) {
item.fullSize = options.fullSize;
item.position = options.position;
item.weight = options.weight;
},
This may be a stale post but I just spent several hours wrestling with what seems like the same problem. Perhaps this will help you and/or future people with this issue:
Before assigning the Chart object as an attribute of your Vue component, call Object.seal(...) on it.
Eg:
const chartObj = new Chart(...);
Object.seal(chartObj);
this.chart = chartObj;
This is what worked for me. Vue aggressively mutates attributes of objects under its purview to add reactivity, and as near as I can tell, this prevents the internals of Chart from recognising those objects to retrieve their configurations from its internal mapping when needed. Object.seal prevents this by barring the object from having any new attributes added to it. I'm counting on Chart having added all the attributes it needs at init time - if I notice any weird behaviour from this I'll update this post.
1 year later, Alan's answer helps me too, but my code failed when calling chart.destroy().
So I searched and found what seems to be the "vue way" of handling it: markRaw, here is an example using options API:
import { markRaw } from 'vue'
// ...
export default {
// ...
beforeUnmount () {
if (this.chart) {
this.chart.destroy()
}
},
methods: {
createChart() {
const chart = new Chart(this.$refs["chartEl"], {
// ... your chart data and options
})
this.chart = markRaw(chart)
},
addData() {
// ... your update
this.chart.update()
},
},
}

Odd Behavior On Export Using NodeJS Module

Using the same code (see fiddle) and 3 different export URLs I get different export results. The issue is that the left side of the chart is clipping off the category titles but only if the export is JPG, PNG, or PDF - the SVG export is fine.
Current output for JPG, PNG, or PDF:
This the expected output for those types and what SVG does export:
I have set up a jsFiddle - click on the image types at the top to see the issues while changing the exporting.url value.
This is the export code:
window.chartExportLoc = function(chartid, exportType, graphHeader, graphFooter, marginSize) {
var chartToExport = $('#' + chartid).highcharts(),
sourceSpacingBottom = chartToExport.options.chart.spacingBottom;
if (!marginSize) {
marginSize = 15; //HighCharts default
}
chartToExport.exportChart({
type: exportType,
scale: 1,
filename: chartid
}, {
title: {
text: unescape(encodeURI(graphHeader)),
margin: marginSize
},
subtitle: {
y: 10,
text: unescape(encodeURI(graphFooter))
},
chart: {
shadow: false,
width: 800,
spacingBottom: sourceSpacingBottom - 20
}
});
return false;
}
We are running the highchart-export-server nodejs module and it is producing the clipped chart. If we change the exporting.url to use our existsing Java-based exporting application we get the correct/expected output. If we then change to use the export server hosted by highcharts (export.highcharts.com) it also produces the expected output.
I did file a bug on github for this issue but no responses from highcharts and hoping someone here can assist. This is preventing us from moving forward with the nodejs implementation and finally sunsetting the Java-based export app.

Feature Card Printer using Rally SDK 2

All
I am working on a feature printing app for Rally so we can generate cards for our analog portfolio kanban board. I wanted to build this printer using the 2.0 SDK. I am usign the original Card print code as my starting spot. My Java Script is rusty and i could us some help getting past this hurdle.
Goals of the App.
Get Data from Rally
Render HTML page with date in for of a card
Handle Printing
I am using a store to pull the data from Rally. This is working as expected.
I am having issue passing the store results in to the array to create the HTML cards. The data is making it to the _displayFeatureCard: function. I can see it in the console print out.
Here is what i have so far.
Ext.define('CustomApp', {
extend: 'Rally.app.App',
componentCls: 'app',
launch: function () {
console.log("App Launched")
//App Calls the portfolio feature data store
this._getfeaturedatastore();
},
//Get the portfolio feature data from Rally
_getfeaturedatastore: function(){
var getfeaturedata = Ext.create('Rally.data.wsapi.Store', {
model: 'PortfolioItem/Feature',
autoLoad: true,
//Create Fillter for the Store
filters: [
{
property: 'State.Name',
value: 'Story Definition',
}
],
listeners: {
load: function(getfeaturedatastore, getfeaturedatadata, success) {
console.log("Got Feature Data Woot",getfeaturedatastore, getfeaturedatadata, success)
this._displayFeatureCard(getfeaturedata);
},
scope: this
},
fetch: ['State', 'Name', 'Description', 'Owner', 'Parent','PlannedStartDate','FormattedID','Tags']
});
},
_displayFeatureCard: function(getfeaturedata){
var MAX_NAME_LEN = 115;
var name,i,theMarkup,data, description, owner, parent, plannedstartdate, formattedid, data;
data = getfeaturedata;
console.log("Woot made it to the Card", data)
for (i = 0; i < data; i++) {
name = data[i].Name;
owner = data[i].Owner;
parent = data[i].Parent;
description = data[i].Description;
plannedstartdate=data[i].PlannedStartDate;
formattedid=data[i].FormattedID;
theMarkup = this.createMarkup(i, data, name, description, owner, parent, plannedstartdate, formattedid);
dojo.byId("cards").innerHTML += theMarkup;
}
},
Checking your code, your app constructor is using Rally's AppSDK 2.0 (ExtJS based), while your _displayFeatureCard method is referencing dojo, which is legacy AppSDK1 and not recommended for use in AppSDK 2.0.
There is a RallyCommunity app for printing Feature Cards (a slightly modified version of PrintStoryCards). It is available here:
https://github.com/RallyCommunity/feature-print-cards
It is also based on the legacy and deprecated AppSDK1. However it still works, and you may find that it meets your requirements.

c3.generate not throwing error

I'm using c3 + d3 + javascript to create a line chart in a webpage. I managed to create a code that was working fine locally, but when I uploaded it to my server, the code stopped working. I explain the problem below:
Problem: c3.generate is not throwing errors when uploaded to server
JSFiddle: http://jsfiddle.net/xq6wmyvp/10/
var chart;
function initialize(path) {
try {
c3.generate({
bindto: '#chart',
data: {
x: 'label',
url: path,
type: 'line',
},
axis: {
x: {
type: 'categories',
label: {
text: 'days',
},
},
y: {
label: {
text: 'yield',
},
tick: {
format: d3.format(".2%")
}
}
},
});
} catch (err) {
return false;
}
return true;
}
var path1 = 'https://gist.githubusercontent.com/SamMorrowDrums/f571240047c0344a4af8/raw/433eae455570b64edcdc7ece39416b468b612f49/test.csv';
alert(initialize('blabla'));
Code explanation: the code (in the fiddle) has a function that initializes a chart with a line graph using some data. The path to the data is given as a variable to that function (which is called 'initialize(path)'). This function uses c3.generate to create the graph. If the data is not available or does not exist, c3.generate throws an error (this works locally, but not when uploaded to a server - this is the problem) and the function (initialize) returns false. If the data exists, the graph is loaded and 'initialize' returns true.
Problem Restated: after uploading the code to a server, the function 'initialize(path)' only returns 'true', even if the data is not available/non-existent.
I don't know how to solve this. Can you help me?
Thanks for reading!
(Github link to problem: https://github.com/masayuki0812/c3/issues/960)
As I stated in my comment, under the hood c3 is using a d3.xhr to retrieve the data. This is an async call meaning that it's outside of your try block.
Possible workarounds include:
1.) fix it in the c3 source code At line 1903, you see the error is being dropped.
2.) create a global error handler
3.) don't use c3's url option. Issue your own d3 xhr request (handle the error the proper way there) and if successful, then call c3.generate with the columns option. This is the way I'd do it.
d3.csv("path/to/file.csv", function(error, json) {
if (error){
// handle error properly
return;
}
c3.generate({
...
});
});

when trying to use PartLoader getting error "arguments.callee.base.call is not a function"

im trying to develop an standalone application with qooxdoo. i want to load each part
of GUI with PartLoader. i just want to load big group boxes when the user select the related menu item from the menu. but when i run the code (execute the part loading related function)
i got the error "arguments.callee.base.call is not a function". im using Firefox 3.6 on windows xp.
this is the my part loading code in Application.js:
qx.io.PartLoader.require(["part1"], function()
{
if (!this.__groupbox1)
{
this.__groupbox1 = new appname.Classname();
container.add(this.__groupbox1, {left:20, top:40});
}
}, this);
this is the Class code to be loaded:
qx.Class.define("appname.Classname",
{
extend : new qx.ui.groupbox.GroupBox,
construct : function()
{
this.base(arguments);
this._addContent();
},
members:
{
_addContent : function()
{
some_ui_parts;
this.add(some_ui.parts);
some_more_ui_parts;
this.add(some_more_ui_parts);
}
}
});
and this is the part of the config.jason related to PartLoader:
"jobs":
{
"common":
{
"packages" :
{
"parts" :
{
"boot" :
{
"include" : [ "${QXTHEME}", "appname.Application" ]
},
"part1" :
{
"include" : [ "appname.Classname" ]
}
}
}
}
}
note: i just replaced real appname & Classname with appname.Classname short.
i searched for this error but i could not find anything related.
You have to change the lines
qx.Class.define("appname.Classname",
{
extend : new qx.ui.groupbox.GroupBox,
to
qx.Class.define("appname.Classname",
{
extend : qx.ui.groupbox.GroupBox,
When you define a new class and extend it the "new" operator is not necessary. More infos about can be found at the Classes documentation at the qooxdoo wiki.

Categories