How to show a legend in QwtPlot3D? - c++

I am working with QwtPlot3D now and I need to show a legend, i.e. something like this:
But I don't know how, and I can't find a suitable tutorial, or examples on the internet. Can anyone help me?

http://qwtplot3d.sourceforge.net/web/doxygen/classQwt3D_1_1Plot3D-members.html
In its list of all members for Plot3D, it lists:
void showColorLegend (bool show)
It that doesn't work, you probably will need to create an instance of ColorLegend and make sure it has the elements you want it to show.
http://qwtplot3d.sourceforge.net/web/doxygen/classQwt3D_1_1ColorLegend.html
Hope that helps.

Related

Use the sheet number to check the active sheet

Before some code runs, I want to check it is the correct sheet.
I can use the sheet name, but my concern is that if someone changes the sheet name, the code won't run. The sheet index also seems to change if the sheet is moved.
Therefore I want to use something that doesn't change.
I believe the sheet number and sheet ID never change.
So I was hoping to use one of them, but I can't see a way of doing that.
What I want in non-coding language is:
If active sheet number = 4 then run the code or
If active sheet ID = 0123456789 then run the code.
Thanks to JPV's link, I have an answer and learned a few things.
You can't use the sheet number to check if the correct sheet is active.
You can use the getSheetId(), but the return you get is not useable.
To make it useable, you need to add getSheetId().toString().
To do the if statement, I needed two equal signs.
if (SpreadsheetApp.getActiveSheet().getSheetId().toString() == 0123456789) {do this when true}
I've been trying to solve this for days, so I should have come here and asked for help earlier.
The main thing I didn't know was the "toString()" part. It always seems so easy and obvious once I know.
Thank you, JPV.
Thanks to JPV's link, I have an answer and learned a few things.
You can't use the sheet number to check if the correct sheet is active.
You can use the getSheetId(), but the return you get is not useable.
To make it useable, you need to add getSheetId().toString().
To do the if statement, I needed two equal signs.
if (SpreadsheetApp.getActiveSheet().getSheetId().toString() == 0123456789) {do this when true}
I've been trying to solve this for days, so I should have come here and asked for help earlier.
The main thing I didn't know was the "toString()" part. It always seems so easy and obvious once I know.
Thank you, JPV.

Add an arrow inside a list (mathematica)

I have a list of variables {a,b,c,d} (the lists I have are much bigger, this is a small example). I want to make the following list: {a->1, b->1, c->1, d->1}. I tried {a,b,c,d}->1, but this does not work and I dont know how to search for the right keywords.
That is pretty easy in Mathematica:
Thread[{a, b, c} -> 1]
Now, that you know this one function Thread, go into the documentation center and read through the material. Then you can look at the very bottom of the doc-page and you find plenty of guides and related functions that give you hints on where to go from there.

parameter order for drag( ) in Raphael.js

The drag method in Raphael has three parameters : onmove, onstart , onend.
Most examples in books show examples in that order , like this
drag(onmove, instart, onend)
and then declare them in any order.
Some examples show the parameters in a different order like:
drag(onstart, onmove, onend)
I have't been able to make it work this 2nd way but there are too many examples in books and the web for me to dismiss as just wrong. But is it wrong?
The docs here say...
Element.drag(onmove, onstart, onend, [mcontext], [scontext], [econtext])
And looking in the code here it supports this.
I'm not sure where you've seen the 2nd form you mention, but it looks wrong, and not sure why 'any order' for parameters would make sense. Maybe if you post a link to those examples, it may give further context. But for your own code, I would follow the docs, and then if that doesn't work, post an example jsfiddle or similar of your code for people to look at.

how to load data to recursive dataView in extjs?

I have a recursive template.
new Ext.XTemplate(
'<tpl for="."><div>'+
'<div class="select">{text}</div>'+
'{[this.putChildren(values)]}'+
' </div></tpl>'
,
{
putChildren:function(values){
if(values.children){
Ext.each(values.children,function(child,index,arr){
return this.apply(values.children);
}
})
I set itemSelector:'select'
The thing is that when I load the data I get an error "records[i] is undefined" and when I set a listener the event is fired on every click but I get item=undefined on every node except the root.
I cant set a treeStore because dataview only excepts store or jsonstore. (maybe I'm doing something wrong?)
so I have a simple question how can I draw a tree using data view and a store?
I couldn't find any good recourse for this...
actually I have a template like this
http://www.youtube.com/watch?v=UhBjMws1H10&t=35m52s
I just cant load the data correctly...
do I need Store or TreeStore or something else?
thnx in advance
So why not use tree Panel?
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.tree.Panel
Have you ever solved this problem? Having the exact same issue. Although I haven't spent a lot of time with it for now.
Maybe it's useful for you to iterate directly through the children.
So, instead of
<tpl for=".">
i think you can directly use
<tpl for="children">
This makes it possible to use values as a variable already for each child.

How to implement previous- and next-links in the object-detail-view of a search-result?

I am almost done with my first production-ready django-project. I got one big problem left:
I got an article-search-view that renders a list of found articles. Pagination is working just fine for the resultlist. When I click on the article-title the object-detail-page opens. What I want: previous- and next-result-links on the object-detail-page.
I tried several approaches to similar problems but didn't find a working solution. If I try to use a paginator with only one article (for the object-detail-page) I need to know that paginator-index in the resultlist. But how?
Even the .get_next(previous)_by_foo-Method is not really usable in this scenario AFAICT. Or am I missing something obvious here? Thanks for any help in advance!
Paginator from django works with lists. A way of searching indexes in lists it's like that:
['aaa', 'bbb', 'ccc'].index('bbb') # result: 1
or so like this:
model = object()
[object(), object(), model].index(model) # result: 2
Hope that gives you a hint on how you find paginator-index on your list.
If you want to get a link, at object-details-page, to next item from search-result, you must get next item from the search-result. To get a next item you need to perform the same search query which was executed in search-page and apply some extra filters to get only the next item from that list. But here you have a problem: you only have object-id in object-details page, you don't have the search-term. Without search-term you won't be able to create the search-query. That means you need to get search-term somehow. How do you get that search-term? You need to pass it from the search-result-page somehow. You can save the search-term in session/cookie, or, maybe better: you can pass it via a GET parameter to object-details page. Now when you search-term in object-display page, you can perform a search-query, and from that query you can select the next and the previous objects.
I think now you should be able to implement that. If not you could show some of your code of object-details view, maybe someone will write some code for you.
you could use this
next »
« previous