Group Abstract Group Abstract

Message Boards Message Boards

How to increase the size of a CDF on screen

GROUPS:
When I open a CDF document in a browser, for example. on the WA Pro or any interactive demonstration projects, I often need to increase the size of CDF to be able to actually see what is happening. Probably I'm doing something wrong, but in WA-Pro the height is often severely limited and on the other CDF is usually the width is limited. 
How to get bigger CDF and maybe even a full screen view ?
POSTED BY: Math Lind
Answer
3 months ago

It's been a whole month since Math Lind posted this question. I sure hope that someone has an answer for this. I would also like larger sizes and I would like a reliable way to match the size of manipulate box to the size specified in the browser. For an example of the problem, see any of the demos at https://faculty.unlv.edu/gbp/mma/VisualComplexAnalysis/CDF/.

POSTED BY: Gary Palmer
Answer
5 days ago

This is a good question and I am surprised no-one has come up with an answer so far. I would also like to increase the size of the output cell on my Manipulate exercises.

POSTED BY: Hamish Small
Answer
3 days ago

Looks like there are two distinct questions here:


1) How to make web-embedded CDF content zoom (change magnification) with the rest of the surrounding web page

This is a feature now supported with the release of Mathematica 10, and coming soon with the new CDF Player. You can see this in action (using the Mathematica 10 plugin) at this Tumblr page:

http://arksphere.tumblr.com/

Use your standard web browser view menu zoom settings to see the top example change size with the rest of the page, whereas the older example below it will remain a static size. A CDF must be saved with version 10 to to enable this behavior, and we're in the process of making these updates to all CDFs in our product sites.


2) How to match a CDF based on Manipulate to the size specified your HTML

Interactive diagrams created with Mathematica's Manipulate function are scalable (to the degree allowed by white space within the Manipulate box) and will adjust their size to the dimensions set by the embed code. For fixed dimensions, configure your content with ImageSize or ContentSize set to an explicit value or size specification. ImageSize->Medium will preserve Mathematica's default dimensions.

You'll find this and other details at the "Formatting Your Content for Embedding" section of the CDF website's deployment page:

http://www.wolfram.com/cdf/resources/deployment-details.html


Hope this information helps, and I will make a point to check in later to see if there are more questions/concerns.

POSTED BY: Andre Kuzniarek
Answer
2 days ago

@Andre, It doesn't seem to work for me. As you say, there is more than one problem. I tried the example page on tumblr and I noticed that it did resize, but it is not clear what the result would be if the page had a color background instead of a white background. In any event, mine will not resize.

https://faculty.unlv.edu/gbp/mma/VisualComplexAnalysis/CDF/Log.function.html

The notebook is attached. I notice that it is not stated above nor in the Wolfram page exactly where the ImageSize --> Medium should be placed. It is not accepted as an option to Manipulate. I have tried it as an option to GraphicsRow. Is there a general rule?

The second problem is that the code produce by the CDF generator does not produce an image on my page, so I used the shorter script. The source for the web page is of course available with a right click. It is quite short.

The CDF was generated in MMA 10, just installed a few hours ago. I used the Export-->Web Embeddable route by selecting the output cell to make the CDF. I'm using Firefox for a browser on OS X 10.9.3. I left the non-working CDF script in the source code for the page, but I inactivated it.

Perhaps you can see the problem.

Gary

Attachments: Log.function.nb
POSTED BY: Gary Palmer
Answer
2 days ago

@Gary, here's my CDF example in its original background:

http://members.wolfram.com/andre/cdf/webscaling

I will take a look at your particular example a bit later today to see if I can be of further assistance, thanks.

POSTED BY: Andre Kuzniarek
Answer
1 day ago

@Andre, thanks. That's how I would like mine to behave.

POSTED BY: Gary Palmer
Answer
1 day ago

Works fine with background color applied to the notebook and exported to CDF with version 10, as shown here:

http://members.wolfram.com/andre/cdf/webscaling/LogFunction.v10.html

I also included a version with the web embed size set smaller than exported size, so you can see the scaling effect from not setting explicit ImageSize for the content (plots). It's the same behavior in a notebook -- if you change the notebook window size you will see the Manipulate shrink rather than be cropped. I'm not a big fan of this behavior on the web, since most developers want the size they see in the exported result and may not find this automatic shrinkage useful.

Anyway, hope this helps!

POSTED BY: Updating Name
Answer
1 day ago

@Andre, It does help. I used Format to change the background color of the cell to light gray and Exported the notebook as an embeddable CDF. In the html file I used the sizes provided by the Export dialog for the bounding box. I now get a gray panel that includes the CDF cell, extends the full width of the html bounding box, and resizes properly. But I see a white panel below the gray panel. Changing the height and/or width of the html bounding box changes the size of the image, but leaves the white panel. I see the same result in Firefox and Chrome.

https://faculty.unlv.edu/gbp/mma/VisualComplexAnalysis/CDF/Log.function.html

POSTED BY: Gary Palmer
Answer
1 day ago

@Gary, without access to your source notebook, I can only guess that the export process is calculating the embed size based on some additional content that is not displayed. You can surely eliminate the white panel by reducing the object size (note the position of the CDF icon in the lower right corner is based on the object size settings).

I do however recommend you copy and paste the embed code provided by the export wizard, rather than just using the "embed" tag.

POSTED BY: Andre Kuzniarek
Answer
1 day ago

@Andre, the notebook is attached. The only change from the previous attachment was to the background of the cell. The size is specified according to previous instructions as ImageSize --> Medium. I put it in the GraphicsRow options because Manipulate rejected it as an option. That is, it prints in red within Manipulate, but it seems to work the same way. The white panel remains. The only other object options that might affect size are the Graphics Plotrange options, but those are necessary to the plot.

I would like to copy and paste the embed code provided by the export wizard, but it doesn't function on the UNLV server. When I use it, I get no image at all, as you can see here:

https://faculty.unlv.edu/gbp/mma/VisualComplexAnalysis/CDF/Log.function.html

Do I need to ask them to install something to make this work?

Attachments: Log.function.cdf
POSTED BY: Gary Palmer
Answer
1 day ago

@Gary, was hoping to look at the notebook you used to generate the CDF. But I can try stripping this CDF back to its normal notebook state and export it myself to see how it sizes. I'm using Mac btw, and will try Windows as well in case there's something going on there.

As for displaying the CDF in web pages using our JS embed code, your example (from your server) works for me viewing in Safari on Mac and IE on Windows, but not in FireFox or Chrome on either platform. It's possible there is some sort of security aspect to this that needs user interaction, or you need MIME types to be set up (see the CDF again for details on that).

POSTED BY: Andre Kuzniarek
Answer
7 hours ago

@Gary, without seeing your original source notebook, I can only guess that the reason your embed object size does not match your CDF might be from exporting while the original notebook was set at a magnified size. Otherwise, I have confirmed no problem getting precise output as desired on Mac and Windows equally. This particular magnification issue should probably be considered a bug, obviously it has the potential to be confusing. I'll get it reported (if it hasn't been already), thanks.

POSTED BY: Andre Kuzniarek
Answer
4 hours ago

@Andre, I don't understand why you are not seeing the source notebook. It was attached to two of the previous messages. But here it is.

Gary

Clear["Global`*"]

Manipulate[

GraphicsRow[

{Graphics[{zLine[lnVs[lnPts[m[Theta]]]],ray[maxr],labelZ},Axes->True,Background->White,PlotRange->{{-2pltRatio ,2pltRatio},{-3pltRatio,3pltRatio}}],

If[m[Theta]>Pi, Graphics[{logCrv2[(#-Pi I)&/@logPts[m[Theta]-Pi ]],logRayCrv[maxr],labelW1,labelW2,piUp,piDwn},Axes->True,Background->White,PlotRange->{{-2pltRatio -5,2pltRatio},{-3pltRatio,3pltRatio}}],

Graphics[{logCrv1[logPts[m[Theta]]],logRayCrv[maxr],labelW1,labelW2,piUp,piDwn},Axes->True,Background->White,PlotRange->{{-2pltRatio -5,2pltRatio},{-3pltRatio,3pltRatio}}]]},

Background->White,Frame->All,Spacings->0,ImageSize->Medium],

{{m[Theta],0,Style["[Theta]",Bold,16]},0,2Pi},{{maxr,2,Style["r",Bold,16]},0,r}, FrameLabel->Style["The Logarithm Function",16,Bold],

Initialization :> (

logf[z_]:=Log[Abs[z]]+I Arg[z];

v[z_]:={Re[z],Im[z]};

z[[Theta],r]:=r Exp[I [Theta]];

r = 2;

pltRatio = 1.5;

zPts[[Theta],r]:=Table[r Exp[I x],{x,0,[Theta],.05}];

lnPts[[Theta]_]:= zPts[[Theta],r];

lnVs[pts_] := v[#]&/@pts;

zLine[vectors_] :={Red,Line[vectors]};

rayPts[maxr_]:= Table[z[Pi/4,r],{r,maxr,.001,-.05}];

ray[r_] := {Blue, Line[v[#]&/@rayPts[r]]};

logPts[[Theta]_]:=logf[#]&/@zPts[[Theta],r];

logCrv1[pts_] := {Red,Line[v[#]&/@pts]};

logCrv2[pts_]:={Red,Line[v[#]&/@pts]};

logRayPts[maxr_] := logf[#]&/@rayPts[maxr];

logRayCrv[maxr_] := {Blue,Line[v[#]&/@logRayPts[maxr]]};

labelZ = Inset[Style["z",Bold,12],{-2,-3}];

labelW1 = Inset[Style["w=Log(z)",Bold,12],{-5,-3}];

labelW2 = Inset[Style["Log(z) = ln|z| + i Arg(z)",Bold,8],{-5,-4}];

piUp = Inset[Style["[Pi]",Bold,12],{.5,Pi}];

piDwn =Inset[Style["-[Pi]",Bold,12],{.5,-Pi}]; )

]

POSTED BY: Gary Palmer
Answer
1 hour ago