Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I get scalable fonts when printing a scattergraph

When printing with cwgraph I would use graph.ControlImage() to get an image
for printing that had scalable fonts.  I cant find a way to duplicate that
with the .net scatterGraph control.  Ive tried graph.Draw() and graph.ToImage()
both print with nonscalable fonts.
0 Kudos
Message 1 of 14
(5,329 Views)

Something interesting, everything seems to scale when I draw the graph components seperatly.

scatterPlot1.Draw(),  xAxis1.Draw(),  yAxis1.Draw()

but not when I use scatterGraph1.Draw()

0 Kudos
Message 2 of 14
(5,324 Views)
Hi,

Take a look at this example, I believe it is what you are looking for.

For Visual Studio 2003
C:\Program Files\National Instruments\MeasurementStudioVS2003\DotNET\Examples\UI\WindowsForms\Graph\Printing\cs

For Visual Studio 2005
C:\Program Files\National Instruments\MeasurementStudioVS2005\DotNET\Examples\UI\WindowsForms\Graph\Printing\cs

Let me know if you have any questions.
0 Kudos
Message 3 of 14
(5,311 Views)

This example helps illustrate my point.  I set my printer as adobe pdf file.

When I print the entire graph the output is unscalable in acrobat.

When I print the stacked graph, which use the individual calls (axis.Draw()) ,

the output is scalable.  I would like to print the entire graph gridlines and all.

But I cant find a way to get all the parts of the graph and still be scalable.

Thanks

0 Kudos
Message 4 of 14
(5,309 Views)
I do not fully understand the behavior that you are seeing.  When you print the entire graph, what do you mean the output is not scalable?  You cannot change the page size to print to?  What behavior are you actually looking for?
0 Kudos
Message 5 of 14
(5,293 Views)
The graph.draw() I think returns a bitmap which is not scalable.  And the axis.draw() returns a metafile which I can then zoom in acrobat without distortion.
0 Kudos
Message 6 of 14
(5,289 Views)
Hi,

Currently, I am having R&D look into this to see if this is a bug or not.  For now, if you are looking for the better resolution, it is best to call the Draw() method on the individual axes.  I do not have a timeframe when R&D will have a response, but feel free to check back with us to check status of this.  Reference the CAR ID# 4919MAON when checking on the status of this.
0 Kudos
Message 7 of 14
(5,266 Views)

any news on this?

 

i've been looking to print a scattergraph to a .pdf.  specifically I want to embed the scattergraph image in a report and export to standard 300dpi.  When I scale the image for the new resolution, convert the image output of the scattergraph to a bitmap, and then set the resolution, I get an image that is very weird.  Specifically, the labels, axis, and gridlines all appear too small (or thin) but kind of scaled (the axis goes from bottom to top of plot but is thin).  I understand there's nothing built in measurement studio but it would be nice if the control worked as expected or their was more explanation on the control behaviour.
0 Kudos
Message 8 of 14
(4,726 Views)

I checked up on the CAR that was filed with R&D, and they determined that fixing this issue could create other larger issues with printing 3D objects, so they elected not to look into it.  If this is something that is heavily desired by the community, feel free to file a product suggestion and R&D will take another look at it.

 

As far as a workaround, try the steps described in the posts above (plot the graph part-by-part).  If that doesn't give your desired result, let me know and I can take a look at it.

Eric B.
National Instruments
0 Kudos
Message 9 of 14
(4,709 Views)

Perhaps my question has morphed into one more suited for a .Net board but since it has morphed here, I'll chance asking it.  Typically, when I draw elements it is to a printer by way of a Graphics object assigned by a PrintPageEventArgs.  This is also what we see in the Printing example provide by National Instruments.  What I want to do is Draw to a Bitmap and save this bitmap rather than draw to a printer.  I thought I figured out how to do this but the axis.Draw() method throws a ArgumentException error and says "Parameter is not valid" without informaption about the parameter.  this is what I have currently:

 

private void PrintPageEntireGraph(object sender, PrintPageEventArgs e)

{

     _scatterGraphBmp = new Bitmap(900, 650, PixelFormat.Format32bppArgb);

     Graphics gBmp = Graphics.FromImage(_scatterGraphBmp);
     gBmp.CompositingMode = CompositingMode.SourceCopy;

     Rectangle plotBounds, xAxisBounds, yAxisBounds;

     GetElementsBounds(e, out plotBounds, out xAxisBounds, out yAxisBounds);

     ComponentDrawArgs fooraibo = new ComponentDrawArgs(gBmp, xAxisBounds);
     xAxis1.Draw(fooraibo, XAxisPosition.Bottom);

}

 

If I change the graphics object to one that is assigned by the PrintPageEventsArg everything works except I am no longer printing to the bitmap.  The scatterGraph.DrawGridLines() and scatterPlo.Draw() methods work just fine using gBmp as an argument.  What am I missing?

 

Thanks,

 

pete

0 Kudos
Message 10 of 14
(4,681 Views)