rendering owc charts in asp.net page

L

Loane Sharp

hi there

am I correct in saying that there are basically 3 different ways of
rendering an owc chart at runtime in an asp.net page, viz. ExportPicture
(physically stored to disk), GetPicture (image streamed to client), and
within <OBJECT CLASSID=...\> tags.

I'm facing the bizarre situation that all three methods work perfectly in
VBScript in my asp.net pages, but since switching all my code to VB.NET
(because I couldn't easily get variables to recognize or talk to one another
between VBScript and VB.NET) they work erratically. For instance, I can't
have a chart drawn using the GetPicture method in a HTML table: the table
doesn't show up but the chart does.

all things equal I prefer the GetPicture method (ExportPicture involes too
much cleaning-up, <OBJECT> tags are too finicky with GACUTIL, registering
PIAs, etc.), but I can't find a way to control the position, etc. of the
image in an HTML table served by my asp.net application.

Do you have any ideas? Please help!
Best regards
Loane


Sub Page_Load()
Dim n As Integer
Dim c As Object, axScale As Object, axValAxis As Object
Dim catData As Object = New Object() {1, 2, 3, 4, 5}
Dim valData As Object = New Object() {1, 2, 3, 4, 5}
With objChart
.Type = ChartChartTypeEnum.chChartTypeBarClustered
.Border.Color = "White"
.HasTitle = True
.Title.Caption = "TOP 10 CANDIDATES"
.Title.Font.Name = "Verdana"
.Title.Font.Bold = True
.Title.Font.Size = "8"
.PlotArea.Interior.Color = "White"
.PlotArea.Border.Color = "White"
.SeriesCollection.Add
.SeriesCollection(0).Caption = "Values"
.SeriesCollection(0).GapWidth = 20
.SeriesCollection(0).Interior.SetSolid(RGB(255, 204, 0))
.SeriesCollection(0).Interior.SetPatterned(ChartPatternTypeEnum.chPattern50Percent,
RGB(255, 204, 0), "White")
.SeriesCollection(0).SetData(ChartDimensionsEnum.chDimCategories,
ChartSpecialDataSourcesEnum.chDataLiteral, catData)
.SeriesCollection(0).SetData(ChartDimensionsEnum.chDimValues,
ChartSpecialDataSourcesEnum.chDataLiteral, valData)
.SeriesCollection(0).DataLabelsCollection.Add
.SeriesCollection(0).DataLabelsCollection(0).HasValue = True
.SeriesCollection(0).DataLabelsCollection(0).NumberFormat = "##0"
.SeriesCollection(0).DataLabelsCollection(0).Font.Name = "Verdana"
.SeriesCollection(0).DataLabelsCollection(0).Font.Size = "8"
.SeriesCollection(0).DataLabelsCollection(0).Position =
ChartDataLabelPositionEnum.chLabelPositionInsideEnd
.Axes(ChartAxisPositionEnum.chAxisPositionBottom).NumberFormat = "##0"
.Axes(0).Font.Name = "Verdana"
.Axes(0).Font.Size = "8"
.Axes(1).HasTitle = True
.Axes(1).Title.Caption = "Evaluation (percent)"
.Axes(1).Title.Font.Name = "Verdana"
.Axes(1).Title.Font.Size = "8"
.Axes(1).Font.Name = "Verdana"
.Axes(1).Font.Size = "8"
End With
axScale =
objCSpace.Charts(0).Axes(ChartAxisPositionEnum.chAxisPositionValue).Scaling
axScale.Maximum = 100
axScale.Minimum = 0
axValAxis =
objCSpace.Charts(0).Axes(ChartAxisPositionEnum.chAxisPositionValue)
axValAxis.HasMajorGridlines = False
axValAxis.HasMinorGridlines = False
End Sub
</SCRIPT>
</HEAD>
<BODY>
<FORM >
<TABLE HEIGHT='100%' WIDTH='100%' CELLSPACING='0' CELLPADDING='0' BORDER='1'
STYLE='VISIBILITY:VISIBLE;POSITION:ABSOLUTE;Z-INDEX:0;'>
<TR HEIGHT='100%'>
<TD WIDTH='100%'>
<%
Response.Clear()
Response.ContentType = "Image/PNG"
Response.BinaryWrite(objCSpace.GetPicture("PNG", 200, 200))
%>
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
 
A

Alvin Bruney - MVP ASP.NET

unless you are doing something really funky, the GACUTIl is not needed. If
you are using visual studio, it automatically finds and uses the Office PIA
when it detects a reference to an unmanaged assembly. You do not have to
reference the PIA. Instead, reference the unmanaged assembly and let visual
studio do the work. This may be one issue why you application is
misbehaving.

--
Regards,
Alvin Bruney

Shameless Author Plug
[The Microsoft Office Web Components Black Book with .NET]
www.lulu.com/owc, Amazon, Barnes & Noble etc
Forth-coming VSTO.NET
 
L

Loane Sharp

Thanks Alvin. I'm a bit old-fashioned and prefer to type all my code in a
text editor (UltraEdit). I've never gotten the hang of Visual Studio, and I
hope it's not a sign of relentless further automation to come from
Microsoft. I find VS about as irritating as the while-you-type spell checker
in Word. This is rapidly becoming a problem. Even your outstanding book
assumes that VS is the tool of choice.
Best regards
Loane


Alvin Bruney - MVP ASP.NET said:
unless you are doing something really funky, the GACUTIl is not needed. If
you are using visual studio, it automatically finds and uses the Office
PIA when it detects a reference to an unmanaged assembly. You do not have
to reference the PIA. Instead, reference the unmanaged assembly and let
visual studio do the work. This may be one issue why you application is
misbehaving.

--
Regards,
Alvin Bruney

Shameless Author Plug
[The Microsoft Office Web Components Black Book with .NET]
www.lulu.com/owc, Amazon, Barnes & Noble etc
Forth-coming VSTO.NET
--------------------------------------------------------------------------------------------------------




Loane Sharp said:
hi there

am I correct in saying that there are basically 3 different ways of
rendering an owc chart at runtime in an asp.net page, viz. ExportPicture
(physically stored to disk), GetPicture (image streamed to client), and
within <OBJECT CLASSID=...\> tags.

I'm facing the bizarre situation that all three methods work perfectly in
VBScript in my asp.net pages, but since switching all my code to VB.NET
(because I couldn't easily get variables to recognize or talk to one
another between VBScript and VB.NET) they work erratically. For instance,
I can't have a chart drawn using the GetPicture method in a HTML table:
the table doesn't show up but the chart does.

all things equal I prefer the GetPicture method (ExportPicture involes
too much cleaning-up, <OBJECT> tags are too finicky with GACUTIL,
registering PIAs, etc.), but I can't find a way to control the position,
etc. of the image in an HTML table served by my asp.net application.

Do you have any ideas? Please help!
Best regards
Loane


Sub Page_Load()
Dim n As Integer
Dim c As Object, axScale As Object, axValAxis As Object
Dim catData As Object = New Object() {1, 2, 3, 4, 5}
Dim valData As Object = New Object() {1, 2, 3, 4, 5}
With objChart
.Type = ChartChartTypeEnum.chChartTypeBarClustered
.Border.Color = "White"
.HasTitle = True
.Title.Caption = "TOP 10 CANDIDATES"
.Title.Font.Name = "Verdana"
.Title.Font.Bold = True
.Title.Font.Size = "8"
.PlotArea.Interior.Color = "White"
.PlotArea.Border.Color = "White"
.SeriesCollection.Add
.SeriesCollection(0).Caption = "Values"
.SeriesCollection(0).GapWidth = 20
.SeriesCollection(0).Interior.SetSolid(RGB(255, 204, 0))

.SeriesCollection(0).Interior.SetPatterned(ChartPatternTypeEnum.chPattern50Percent,
RGB(255, 204, 0), "White")
.SeriesCollection(0).SetData(ChartDimensionsEnum.chDimCategories,
ChartSpecialDataSourcesEnum.chDataLiteral, catData)
.SeriesCollection(0).SetData(ChartDimensionsEnum.chDimValues,
ChartSpecialDataSourcesEnum.chDataLiteral, valData)
.SeriesCollection(0).DataLabelsCollection.Add
.SeriesCollection(0).DataLabelsCollection(0).HasValue = True
.SeriesCollection(0).DataLabelsCollection(0).NumberFormat = "##0"
.SeriesCollection(0).DataLabelsCollection(0).Font.Name = "Verdana"
.SeriesCollection(0).DataLabelsCollection(0).Font.Size = "8"
.SeriesCollection(0).DataLabelsCollection(0).Position =
ChartDataLabelPositionEnum.chLabelPositionInsideEnd
.Axes(ChartAxisPositionEnum.chAxisPositionBottom).NumberFormat = "##0"
.Axes(0).Font.Name = "Verdana"
.Axes(0).Font.Size = "8"
.Axes(1).HasTitle = True
.Axes(1).Title.Caption = "Evaluation (percent)"
.Axes(1).Title.Font.Name = "Verdana"
.Axes(1).Title.Font.Size = "8"
.Axes(1).Font.Name = "Verdana"
.Axes(1).Font.Size = "8"
End With
axScale =
objCSpace.Charts(0).Axes(ChartAxisPositionEnum.chAxisPositionValue).Scaling
axScale.Maximum = 100
axScale.Minimum = 0
axValAxis =
objCSpace.Charts(0).Axes(ChartAxisPositionEnum.chAxisPositionValue)
axValAxis.HasMajorGridlines = False
axValAxis.HasMinorGridlines = False
End Sub
</SCRIPT>
</HEAD>
<BODY>
<FORM >
<TABLE HEIGHT='100%' WIDTH='100%' CELLSPACING='0' CELLPADDING='0'
BORDER='1' STYLE='VISIBILITY:VISIBLE;POSITION:ABSOLUTE;Z-INDEX:0;'>
<TR HEIGHT='100%'>
<TD WIDTH='100%'>
<%
Response.Clear()
Response.ContentType = "Image/PNG"
Response.BinaryWrite(objCSpace.GetPicture("PNG", 200, 200))
%>
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
 
A

Alvin Bruney - ASP.NET MVP

post a small snippet of code that demonstrates the problem, i'll take a
look. It really shouldn't matter what you use to develop office based
applications - notepad, vs or emacs for instance, the underlying platform
should always behave consistently.

--
Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------



Loane Sharp said:
Thanks Alvin. I'm a bit old-fashioned and prefer to type all my code in a
text editor (UltraEdit). I've never gotten the hang of Visual Studio, and I
hope it's not a sign of relentless further automation to come from
Microsoft. I find VS about as irritating as the while-you-type spell checker
in Word. This is rapidly becoming a problem. Even your outstanding book
assumes that VS is the tool of choice.
Best regards
Loane


Alvin Bruney - MVP ASP.NET said:
unless you are doing something really funky, the GACUTIl is not needed. If
you are using visual studio, it automatically finds and uses the Office
PIA when it detects a reference to an unmanaged assembly. You do not have
to reference the PIA. Instead, reference the unmanaged assembly and let
visual studio do the work. This may be one issue why you application is
misbehaving.

--
Regards,
Alvin Bruney

Shameless Author Plug
[The Microsoft Office Web Components Black Book with .NET]
www.lulu.com/owc, Amazon, Barnes & Noble etc
Forth-coming VSTO.NET
-------------------------------------------------------------------------- ------------------------------




Loane Sharp said:
hi there

am I correct in saying that there are basically 3 different ways of
rendering an owc chart at runtime in an asp.net page, viz. ExportPicture
(physically stored to disk), GetPicture (image streamed to client), and
within <OBJECT CLASSID=...\> tags.

I'm facing the bizarre situation that all three methods work perfectly in
VBScript in my asp.net pages, but since switching all my code to VB.NET
(because I couldn't easily get variables to recognize or talk to one
another between VBScript and VB.NET) they work erratically. For instance,
I can't have a chart drawn using the GetPicture method in a HTML table:
the table doesn't show up but the chart does.

all things equal I prefer the GetPicture method (ExportPicture involes
too much cleaning-up, <OBJECT> tags are too finicky with GACUTIL,
registering PIAs, etc.), but I can't find a way to control the position,
etc. of the image in an HTML table served by my asp.net application.

Do you have any ideas? Please help!
Best regards
Loane


Sub Page_Load()
Dim n As Integer
Dim c As Object, axScale As Object, axValAxis As Object
Dim catData As Object = New Object() {1, 2, 3, 4, 5}
Dim valData As Object = New Object() {1, 2, 3, 4, 5}
With objChart
.Type = ChartChartTypeEnum.chChartTypeBarClustered
.Border.Color = "White"
.HasTitle = True
.Title.Caption = "TOP 10 CANDIDATES"
.Title.Font.Name = "Verdana"
.Title.Font.Bold = True
.Title.Font.Size = "8"
.PlotArea.Interior.Color = "White"
.PlotArea.Border.Color = "White"
.SeriesCollection.Add
.SeriesCollection(0).Caption = "Values"
.SeriesCollection(0).GapWidth = 20
.SeriesCollection(0).Interior.SetSolid(RGB(255, 204, 0))
..SeriesCollection(0).Interior.SetPatterned(ChartPatternTypeEnum.chPattern50P
ercent,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top