Group Abstract Group Abstract

Message Boards Message Boards

0
|
19.3K Views
|
17 Replies
|
1 Total Like
View groups...
Share
Share this post:

How to increase the size of a CDF on screen

Posted 12 years ago
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
17 Replies
Posted 11 years 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.

P. S. This code has been edited so it can now be cut and pasted into a notebook, where it should produce a plot.

Gary

Clear["Global`*"]

Manipulate[

GraphicsRow[

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

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

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

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

{{mTheta,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

Gary, not sure if this is what Andre means, but the notebook you attached has no code (Andre: "...original source notebook..."). You added code in the post but it is corrupted somehow - if you evaluate it, it will break. This happens when code is not formatted properly. This tutorial will tell you how to format code so it can be copy-pasted from Community to a notebook. I see moderators already tried to format your code - but it is too late - some typos creeped in. You can edit your last post, paste code again and format it correctly. Alternatively you could just attach a notebook with the code.

I hope this helps. Sam.

POSTED BY: Sam Carrettie
Posted 11 years ago

@Sam and @Andre, I'm sorry the code didn't work. I see now that I mistakenly attached a .cdf file rather than a notebook, but I did previously attach a notebook in my second message on this thread. I just now opened it from this page and it produced a plot. Nevertheless, a copy is attached with this message. Thank you for the link to the tutorial. When I clicked on the link with the intention of editing the code in the message above, it appeared to respond, but then it returned me to this page, so I was unable to read it.

Attachments:
POSTED BY: Gary Palmer
POSTED BY: Andre Kuzniarek
Posted 11 years ago
POSTED BY: Gary Palmer

@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

@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
Posted 11 years ago
Attachments:
POSTED BY: Gary Palmer
POSTED BY: Andre Kuzniarek
Posted 11 years ago
POSTED BY: Gary Palmer
Posted 11 years ago
POSTED BY: Gary Palmer
Posted 11 years 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
Posted 11 years ago
Attachments:
POSTED BY: Gary Palmer

@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

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

</br>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
Posted 11 years 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
Posted 11 years 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
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard