Currently I have 4 charts. The selection (via column or legend) of a category from the main one triggers multiple events. It changes the selected item's color on two charts and it creates two more charts.
For the two created charts, I'm having problems with redrawing/removing (that is what I'm assuming I will have to do) when the column/legend is deselected.
I may be wrong but from what I've looked at, it seems that when you prevent show/hide it doesn't change the visibility property so I wasn't sure if there was a way to use that.
Any help would be appreciated!
Fiddle here: http://jsfiddle.net/jlm578/gy9og69r/4/
I also thought about whether I needed to add it into the logic of the function (possibly one below) or if the sibling aspect needed to be added to the others.
function drawSignifNonSignifEruptionsChart(series){
if (series.index == '0'){
var eruptVEI = ['VEI 0'];
var signifErupt = [10];
var nonSignifErupt = [600];
}
Related
Let's suppose, I'm creating a image editor, something like Photoshop, but simplier in Qt.
I got next problem - I have list of items and I can select only one of them at a time. Each item got QWidget which should be shown in MainWindow. The question is - should I create them(widgets) when I select item or should I just manage visibility of this widgets. Currently, I got the second solution - when item selected, I set the visibility of QWidget to true, and hide current widget. What is better in case of performance? I'm new to Qt, don't which practice is better to use in such case.
For better understanding - attaching a picture with sidebar and place for QWidget(blurred woman)
Disclaimer: It's not a opinion question - I'm asking about best practice in Qt and performance in each case. Thanks.
Here is an example using QListWidget and QListWidgetItem controlling the QStackedWidget:
// Stacked widget
QStackedWidget *pStackedWidget = new QStackedWidget();
// Creating widget list
QListWidget *pListWidget = new QListWidget();
connect(pListWidget, &QListWidget::itemSelectionChanged,
[pStackedWidget, pListWidget]() {
pStackedWidget->setCurrentIndex(
pListWidget->currentItem()->data(Qt::UserRole)
);
}
);
// Populating widget list with items
QListWidgetItem *pItem = new QListWidgetItem();
pListWidget->addItem(pItem);
pItem->setItemWidget(pItem, pWidget);
pItem->setData(Qt::UserRole, 0 /* widget index on stacked layout */);
Visibility of the widgets on the right is controlled by the QStackedWidget. Corresponding widget index is set upon selection change in the QListWidget.
Widget index can be stored in custom user data assigned to corresponding QListWidgetItem.
I am developing a "Dashboard Report" in SSRS Visual Studio 2010. I Am trying to put 8 charts graphs at the same location. Each chart must open from each textbox I assigned a toggle. Each chart has the visibility as Hidden and display by textbox name.
Now I am trying to make a validation which determine that only one chart must show at the time. Because when I try to see an individual chart always I have to close which was open before.
I have created a parameter to assign an InitialToggleState Expression, but I haven't succeed.
I will appreciated any good suggestion step by step. Thanks
Have you considered using a Hidden parameter to control which chart is open? By defining one you can use the textboxes to control an identifier for which chart you wish to display.
Method
First define a Hidden Pameter by creating a new parameter and setting the visibility to ‘Hidden’. I have created one called OpenChart
Create your charts (you have probably already done this by the looks of things. Set each charts visibility to be equivalent to
=iif(Parameters!OpenChart.Value = 1, false, true)
Changing the value ‘1’ to a unique number for each chart
Create your control buttons, possibly using text boxes. Create as many buttons as there are charts to disaply (you’ve probably done this already too). For each button Set the action to be a reloading of this report, using the same existing parameters, but with the OpenCahrt Parameter set to the chart identifier set in 2. Above
The report now looks like this (for 3 buttons)
Result
When the report is run and the ‘One’ textbox is clicked the output looks like this
And for 'Two' like this
And so on...
You don’t have to put the charts side by side of course, they can be layered on top of each other. I only laid them out like this for clarity.
Hopefully this will help save you from trying to validate all the charts are closed before the next one is open, because only one can be open at a time.
Please let me know if you need further clarification
I'm trying to build a visualisation to graph what I've been reading this year.
Currently I have everything grouped via Quantity of novels. I'm wondering if it's possible to change the group in real time or if I'm stuck with a group once I've set it.
The code that I've got now to calculate the groups looks something like this:
function groupByType(dimension){
if($('#ValueType').is(':checked')) {
console.log("Pages")
return dimension.group()
.reduceSum(function(d) {
return d.Pages;
});
} else {
console.log("Volumes");
return dimension.group();
}
}
Whenever the checkbox (#ValueType) is clicked I'm calling a dc.redraw on the entire graph which I was hoping would change the way the group is being calculated but it's not doing so. Is there way to change the group dynamically or would I be better off just refreshing the page and passing a parameter when it loads?
It's a bit hard to tell, but it looks like every time you check or uncheck the checkbox, you create a new group. You do not want to do this as the groups stick around and continue getting updated. Things will just get slower and slower.
Just create the 2 groups upfront (and perhaps even 2 dc.js charts) and then let the checkbox control which group is assigned to the chart or which chart is displayed.
I have a basic treegrid with 2 levels, and I want some rows hidden and others visible; I do this with $("#" + rowId).hide() and $("#" + rowId).show() programatically, as which rows are visible is dependent on data outside the grid. That part works fine.
However, when I collapse a node and then expand it, all children are visible, even those I hid. Evidently, jqGrid is pretty much just doing .hide() and .show() on the rows, which negates my settings. So my thought is to add a hidden field in each row that stores whether it should be visible or not, and then re-hide/show after the expand event. The problem is, I'm not sure how to catch the event and execute code immediately after it.
Oleg shows a method for catching the events here: jqGrid treeGrid catch expand collaps events
Unfortunately, that doesn't work for me because it will just override whatever hide/show I do there. I need to execute code after the jqGrid functions. Any ideas on how to do this?
The solution seems very easy for me. One need just make small modification from the code from the answer which you reference. You can do something like the following
var orgExpandNode = $.fn.jqGrid.expandNode;
$.jgrid.extend({
expandNode: function (rc) {
// here you can insert the code which will be executed
// before the original expandNode
var res = orgExpandNode.call(this, rc);
// now you can execute some code after the original expandNode
// for example the next line hide the node in the grid
$("#1_1_1").hide(); // hide some row of the grid
return res; // return the value from expandNode
}
});
see the demo. The demo has one node in the TreeGrid which has id="1_1_1", but it stay hidden all the time.
UPDATED: Free jqGrid have beforeExpandRow, afterExpandRow, beforeExpandNode and afterExpandNode callbacks and "jqGridTreeGridBeforeExpandRow", "jqGridTreeGridAfterExpandRow", "jqGridTreeGridBeforeExpandNode", "jqGridTreeGridAfterExpandNode" events. Thus subclassing of TreeGrid methods described above is not required in case of usage free jqGrid.
I have a multiselect jqGrid with a multiselect grid-as-subgrid. In the onSelectRow event for the parent grid, how can I grab a reference to the child grid?
Essentially, I need to do the following:
Expand the subgrid (so as to load its data from the server)
Get a reference to that subgrid
With the reference, loop through the rows and set each one to selected (For rows which have a nested subgrid of their own, this will trigger their onSelectRow and repeat the process. Don't worry, the grid is no more than 3 nestings deep.)
I'm looking through the various documentation this morning, but so far haven't spotted what I need to make this happen. Maybe I'm just missing the obvious? Or maybe this would require a bit more cleverness?
I see how Step 3 above can be accomplished starting with getRowData() and looping through the results with setSelection(). I use those elsewhere in code and they work great. But Steps 1 and 2 above are where I'm stuck at the moment.
Edit: Following #Oleg's answer below, I looked a bit more into synchronizing efforts between a parent grid's onSelectRow event and subGridRowExpanded event. Here's a boiled down version of what I'm testing right now:
onSelectRow: function(id, status) {
// Automatically expand the sub-grid (to load the data) and select the rows in that grid
autoSelecting = true; // autoSelecting is a global variable normally set to false
$('#mainGrid').expandSubGridRow(id);
}
subGridRowExpanded: function(subgrid_id, row_id) {
//... build the sub-grid, works fine (an artifact of which is a subgrid_table_id)
// If this grid was auto-expanded to be auto-selected, select all its rows
if (autoSelecting) {
var sdata = $('#' + subgrid_table_id).getRowData();
for (var i = 0; i < sdata.length; i++) {
$('#' + subgrid_table_id).setSelection(sdata[i].Id);
}
autoSelecting = false;
}
}
A few things are happening here as I tinker with this:
If I'm stepping through FireBug to debug this, selections and sub-selections work correctly. However, if I take out breakpoints and try it in real-time, sub-selections don't happen. The sub-grid expands, but its rows don't get selected. I figure there's a timing issue in there somewhere.
I haven't accounted for cascading de-selects yet, clearly.
If the sub-grid is already expanded, the selecting doesn't cascade.
Inside of loadComplete event handler the grid is loaded and you can do some additional actions like expanding of some rows.
You can expand the subgrid with respect of expandSubGridRow method.
To get the reference to the subgrid the subgrid should be created first. So the best place to reference of the grid is subGridRowExpanded event. You don't posted the JavaScript code which you use, so it is difficult to describe all more exactly.
To select all rows you can use setSelection in the loop or use code like $('.cbox', myGrid[0]).trigger('click'); There are different other variation how to do the same. If you will see that you have performance bottleneck here then I could describe how you can do the step more effective.
I can repeat, that the most important that you expand or select the rows after the grid data (or the subgrid data) is loaded.