Changing the number of divisions in graph scale - visio

I'm having a little problem with graph scale in visio. My goal for now is to make a graph scale (belongs to charting shapes) with 22 divisions in it. But I don't know how to add an option of 22 divisions on the scale (2, 4 and 5 division options are available).
I have tried to add 22 division option in "Define Shape Data" window, but unlucky.
I have searched whole internet for the solution, but I found no solution.
I hope someone here will know the solution.

Just adding 22 to the options will not magically make 22 divisions appear. You will also need to have the shapes (or geometry sections) behind it (22 of them, not just 2, 4 or 5) to be made visible when 22 is selected.
You need to understand how the whole shape is constructed, by looking at the various group sub-shapes (and/or geometry sections) to see how each is made visible/invisible when the 2/4/5 selection is made.

Related

uicontrol slider type min max sliderstep

I am trying to add a scrollbar (a slider) to a fixed-height figure. There is a panel inside the figure and on the panel, there are multiple plots. The panel is longer in Y direction than that of the figure so that the slider will be necessary to see the hidden plots. I've created it and it is sort of working: showing the plots as the slider moves up and down.
The reason why I said "sort of" is because I couldn't understand the slider behavior with respect to its Min, Max, and SliderStep.
What I want to do is as follows:
Say I have 10 plots
The figure height allows only 6 to be shown (plot 1 through 6)
I want the slider size to be 6/10 of the figure height
So that it only takes one click (down arrow) to see the rest of the plots, but this time plots 5 through 10 will be shown
If I have 18 plots, then it should take two down-arrow clicks to see the last set of 6 figures and the slider size should be 1/3 of the figure height
I searched and searched for hours today, but I couldn't even find a good documentation on how to use Min and Max in conjunction with SliderStep. All I could find was a comment that says "if you play enough with them, you'll get the size the way you want". So, I played with them for another hours, but its behavior just doesn't make sense.

Matlab multi-column legend & subplots

I have a legend with 7 entries, some of which are on one subplot, some are on another, and some are common to both plots. I have managed to get all of these entries into one legend using some help I found online, which was great.
Only problem I have now is that the strings for each entry are quite long, so I ideally need them in 2 columns with the 7th entry centred in the middle at the bottom of the legend. I have found various options to do a multi-columned legend:
Code for a multicolumn legend in Matlab
http://www.mathworks.co.uk/matlabcentral/fileexchange/27389-columnlegend
http://www.mathworks.co.uk/matlabcentral/fileexchange/29248-gridlegend-a-multi-column-format-for-legends
But I can't work out how to combine them with the way I have already worked out how to do the legend.
This is MWE of what I have so far:
xdata=1:1:10;
ydata=0:0.1:0.9;
% Line colours
cm=[32 114 214;145 205 237;0 129 63;247 217 9;255 127 0;184 18 21];
cm=cm/255;
h1=subplot(2,1,1);
l1=line(xdata,ydata,'Color',cm(1,:));
l2=line(xdata,ydata,'Color',cm(2,:));
l3=line(xdata,ydata,'Color',cm(3,:));
l5=line(xdata,ydata,'Color',cm(5,:));
l7=line(xdata,ydata,'Color','k','LineStyle','--');
h2=subplot(2,1,2);
l4=line(xdata,ydata,'Color',cm(4,:));
l6=line(xdata,ydata,'Color',cm(6,:));
line(xdata,ydata,'Color','k','LineStyle','--');
hL=legend(h2,[l1,l2,l3,l4,l5,l6,l7],{'Second/Multi-year La Niña','First/Single-year La Niña','Neutral ENSO years','First/Single-year El Niño','El Niño years','Second/Multi-year El Niño','All Years (1901-2011)'},'Location','SouthOutside','Orientation','horizontal');
set(hL,'Units','centimeters');
Lpos=get(hL,'Position');
Lpos(1)=0;
Lpos(2)=0;
set(hL,'Position',Lpos);
My actual data doesn't overlap so you can see all the lines. Was just easier to have it like that for the example.
Can anyone help me out with the layout I need for the legend? It may well be that I can use one of the 3 options I already found, but I don't really understand what they do well enough to apply it to my situation.
I found another work around with this, which is to create 3 separate legends and then position them where I want. I made a 3rd subplot which has the 'Visible','off' setting and called my three legends using the following code:
lg1=legend(h1,[l1,l2,l3],{'a','b','c'});
lg2=legend(h2,[l4,l5,l6],{'d','e','f'});
lg3=legend(h3,l7,{'g'});
where h1-3 are the subplots, l1-7 are the 7 lines, and a-g are the legend text. I have then rearranged them using get(lg1,'Position'), changing the position vector, and resetting it using set(lg1,'Position',...) (replace ... with the position vector). I turned the box off around the three legends, but plan on putting a box all round the edge so it looks like it is one legend.
Not the prettiest way to do it, but it worked for what I needed to do.

Star-Rating Feature in GWT: how to implement partially-filled stars?

How would one implement a star-rating feature like this in GWT? Does a library exist?
Main scenario: display a decimal rating as partially filled stars.
A call to server returns a [0, 5] decimal rating/grade, say 3.4.
UI display 3.4/5 filled stars, something looking like this .
By default, the best approach I can think of would be to create a number of small pre-filled images in a client bundle with a given rating resolution, say 0.5 (~ 10 images) or 0.1 (~ 50) images. And then write the mapping logic to display the appropriate star-filled image.
Is is the most efficient way of going about it?
A perhaps optimized version of this approach would be to have images of one partially filled star and then the display logic would assembled the 5 stars as function of rating -- e.g., for 3.4, 3 fully filled stars, one partially filled star to 0.4 level, one empty star.
Complement scenario: enter an integer rating {0, 1, 2, 3, 4, 5} stars.
Display five void stars.
When user mouse over a star, the star and all stars to the left fill up.
When user click, integer rating is registered.
Using a similar approach as above, two-images would suffice: one with no background, one filled.
Again, is there a widget/library out there wrapping such a common web-app feature?
It does not seem difficult to implement but no need to re-invent the wheel! A good library of such a common web-app feature could have more embedded functions like managing the rating list by rating and their corresponding display, entering review panel, etc, all performance optimized.
Create three star images: complete, empty and half-full.
Create a custom widget. Use FlowPanel as a container with star images inside.
Create method showRating() in this widget:
(a) Clear stars if you already had them.
(b) Add complete star images for each round point.
(c) Add half-empty star image for half-point, if necessary.
(d) Add empty star images if necessary to make 5 stars in total.
It's a fairly simply widget. You don't need a library for that.

Clickable transparent lines are impossible in MATLAB?

So I have 3 lines (technically patches) that have some transparency enabled. These lines were generated by the patchline FEX submission. The FEX entry works great by making patches seem like lines by adding a NaN to the end of the data so it doesn't create a big black patch between the end points of my line.
My lines looks like this
__ __
\ /
_ \ / _
\ \__/ /
\______/
The patch extends from the left end point to the right end point in a straight line across the top and then follows the line on the bottom. The actual patch is hidden (not drawn) though so all the user sees is the lines
The problem is if I wanted to click the bottom hump of the top line, it acts like I clicked the bottom line because it is part of that patch.
I have thought of a couple of workarounds and was hoping you guys could point out flaws or add ideas I might have missed with my workarounds.
Workaround #1
Ideally, I would create an actual line (line series obj.) over the transparent lines. I would turn hittest off on the patches and I would make the actual line invisible, but turn hittest on. The problem I am 99% sure exists is that if visibilty is off, you can't click the object. If anybody has a work around to that issue (documented or otherwise), that would be great.
Workaround #2
Turn the patchline hittest property to off. Make mock line objs. that follow the patchline coords. and have a line width very very small so as to make the line ideally pretty much invisible and have hit test clicks point to these lines instead. Has anybody tried something like this before? (I'm at work and can't try it now)
Workaround #3
NOTE THAT I REALLY DONT WANT TO DO THIS It is of course possible to turn off hittest for the patch/line objs and use the axes buttondown to figure out what patch obj (just the line part) it was closest to.
Once again, any insight would be much appreciated either about my possible work arounds, the situation in general, etc.
Thanks, Shaun
The problem can be illustrated with two line-thick patches, one of which is NOT parallel to the axes:
patch([2 8 8],[5 10 10],'w','EdgeColor','b','EdgeAlpha',0.4,'LineWidth',3)
patch([2 8 8],[4 4 4],'w','EdgeColor','r','EdgeAlpha',0.4,'LineWidth',3)
xlim([0 10])
ylim([3 11])
You cannot select but those lines which are parallel to one of the axes.
Workaround #1: impossible.
Workaround #2: quite visible, why would you need transparent lines then?
Workaround #3: the only way...
Workaround alternative: submit to the TMW a technical request to improve clickability of patches.
Oleg, your initial post somehow inspired me to come up with my elegant solution. (Don't ask me how, just accept my "thank you" haha)
The elegant solution to my problem required me to go beyond patch properties and turn to the axes child order. Under the assumption that none of the lines would intersect each other, I was able to plot them in a order where the bottom one was first, then the second lowest, etc. until I got to the top (effectively rearranging child order).
If anybody else stumbles upon this, what you can do (assuming your lines don't intersect) is to sort the first Y (or whatever values) to go from lowest to highest (in this case) in your plot, and make sure your sort function returns the indicies.
I don't have my computer in front of me, but what you end up doing is effectively making an acontinuous for loop, looping through the indicies.
something like:
for i=[6 2 5 4 1 3]
plot(X(:,i),Y(:,i))
end
Where the 6th column was my lowest data, 2nd column was second lowest on plot, etc.

D3 Stacked Bar Chart outer padding

I've been working on adapting the stacked bar chart example (http://bl.ocks.org/mbostock/1134768). The problem I'm having is that there's
always outerpadding. The API lists the outer padding as a 3rd option, but omitting
it or setting it to 0 still leaves some padding. In most cases, it isn't too bad,
but with large data sets it tends to be a huge amount of padding. For all the code
relevant to my issue, you can check the link above. It's not very noticeable in that
example, but the first bar isn't drawn until about 12 pixels (in larger data sets I'm using
this can be at 100 or more pixels); I want it to start at 0 pixels.
Thanks! If you need any more explanation just let me know and I'll do my best.
EDIT: After testing, it appears rangeBands() starts at 0, but I'm still not sure why the rounding
from round bands would round as much as it did. Oh well, I can deal with using rangeBands.