Solved

Office Web Component Commands

Posted on 2001-06-15
29
793 Views
Last Modified: 2007-11-27
<%
'Add a Clustered Column Chart with a legend to the Chartspace
set m_cspace = server.CreateObject("OWC.Chart")
set cht = m_cspace.Charts.Add()
set c = m_cspace.Constants
cht.Type = c.chChartTypeColumnClustered
cht.HasLegend = True



'set the Chartspace's data source to the Recordset and add the
'SalesPerson field for series names, the Month field for the chart's
'categories and the Sales field for the chart's values
set m_cspace.DataSource = rs
cht.SetData c.chDimCategories, 0, "DATE"
cht.SetData c.chDimValues, 0, "TOTALNUMBEROFCALLS"

'add a chart title and format the title

cht.HasTitle = True
cht.Title.Caption = "JuzzFone Calls Report"
set fnt = cht.Title.Font
fnt.Name = "Tahoma"
fnt.Size = 10
fnt.Bold = True


'add a title to the category axis and format the title
set ax = cht.Axes(c.chAxisPositionBottom)
ax.HasTitle = True
ax.Title.Caption = "DATE"

''HERE I WANT FORM THE X AXIS DATES IN VERTICAL FORMAT


set fnt = ax.Title.Font
fnt.Name = "Tahoma"
fnt.Size = 8
fnt.Bold = True

'add a title to the value axis and format the title
set ax = cht.Axes(c.chAxisPositionLeft)
ax.HasTitle = True
ax.Title.Caption = "TOTALNUMBEROFCALLS"
set fnt = ax.Title.Font
fnt.Name = "Tahoma"
fnt.Size = 8
fnt.Bold = True

'Save the current chart to a GIF file with a temporary, unique filename
set m_fso = CreateObject("Scripting.FileSystemObject")
sFullFileName = Server.MapPath(".") & "\" & m_fso.GetTempName()
m_cspace.ExportPicture sFullFileName, "gif", 800, 400

'Use On Error Resume Next to make sure we eventually delete
'the temporary GIF file even if something fails in the next couple
'of functions
on error resume next

'The GIF file has been created. Return the contents of the GIF file as
'binary data using the BinaryFileStream ActiveX DLL
set m_objBinaryFile = server.CreateObject("BinaryFileStream.Object")
Response.BinaryWrite m_objBinaryFile.GetFileBytes(CStr(sFullFileName))

'Delete the GIF file since it is no longer needed
m_objBinaryFile.DeleteFile CStr(sFullFileName)

%>



Using the above code I am doing the Chart.. the problem is
the X axis  members (DATE)comes in the horizontal format which is not very good .. I would like to change it in the vertical format.. help pls..

With Cheers.
0
Comment
Question by:ksenthilraj
  • 14
  • 10
  • 4
  • +1
29 Comments
 
LVL 15

Expert Comment

by:ozymandias
Comment Utility
I don't know which property you ned to set for this, or even if it is possible, but if it is it will be in the Object Reference Documentation for the MSOWC which you can download from Microsoft. The file you need is : MSOWCVBA.CHM. If you have MS Office installed you will probably find it here :

c:\program files\Microsoft Office\Office\1033\

The 1033 language code will be different if you have installed Office in a language other than US English.

Cheers.
0
 
LVL 11

Expert Comment

by:ASPGuru
Comment Utility
sorry, not possible...
0
 
LVL 1

Author Comment

by:ksenthilraj
Comment Utility
Hai ASPGURu,

But it is possible in the EXCEL.. We are using Office web components only.. So I think it is possible but i doknow
the property name...

With Cheers.
0
 
LVL 1

Author Comment

by:ksenthilraj
Comment Utility
Hai ASPGURu,

But it is possible in the EXCEL.. We are using Office web components only.. So I think it is possible but i doknow
the property name...

With Cheers.
0
 
LVL 11

Expert Comment

by:ASPGuru
Comment Utility
> But it is possible in the EXCEL
yes!

> We are using Office web components only.. So I think it is possible but i doknow the property name

no!

OWC is not Excel... sorry.
0
 
LVL 15

Expert Comment

by:ozymandias
Comment Utility
MSOWC, is the web component API for the some of the Microsoft Office Components. It exposes a subset of the components' API. Obviously the setting that allows you to change the orientation of the tick lables on the chart axes is not part of the API subset that has been exposed, hence it is available in Excel but not via MSOWC.
0
 
LVL 1

Expert Comment

by:pclaypool
Comment Utility
cht.ax(xlValue).TickLables.fnt = xlTickLabelOrientationVertical

or (if you do not want to set the constants of he chart Object:

cht.ax(2).TickLables.fnt = -4166
0
 
LVL 15

Expert Comment

by:ozymandias
Comment Utility
You can use that API in Excel and other Office apps that use VBA, but I do not believe it will work using MSOWC. As I said, I don't think that part of the API is accessible from ASP pages.
0
 
LVL 11

Expert Comment

by:ASPGuru
Comment Utility
ksenthilraj, read the documentation in MSOWCVBA.CHM and you'll see, that i'm right and that the chart component doesn't support what you want....
0
 
LVL 1

Author Comment

by:ksenthilraj
Comment Utility
Dear Experts,

It is really very good response..

Now i am checking the MSOWCVBA.CHM  think as per your suggestion.

AspGuru Is it possible to draw the Line Graph as like this graph... If it is possible please give some code for that..

With Cheers
0
 
LVL 11

Expert Comment

by:ASPGuru
Comment Utility
i'm not sure what you exactly want...

if you want to change the Type of the graph, then look in the documentation for wcchart.type... there are 40+ different types....
0
 
LVL 1

Author Comment

by:ksenthilraj
Comment Utility
ok.. aspguru  what i really want is i  tild the
data's which are coming in the X- AXIS that is my first point..  

    !
    !
    !              
    !
----!--------------------------------
    !I WOULD LIKE TO TILT THE DATA'S VERTICALLY WHAT COMES   HERE.


I think this makes clear you...  

 
DATE

the second one I got from the help topics that the types of graphs..  

I need some links which contains OWC examples or you can provide..  I think this too high for this points .. if the comments are good then i will increase the points too.

With Cheers.

0
 
LVL 1

Author Comment

by:ksenthilraj
Comment Utility
Dear Experts,

No reply..   Any comments..

WIth Cheers
0
 
LVL 15

Expert Comment

by:ozymandias
Comment Utility
ksenthilraj, I think we have established that using MSOWC from ASP it is not possible to acheive part one of you question, e.g to tilt the angle of the tick-labels on the x-axis.

For part two (the examples) the best place to look is on the Microsoft Dveloper Network (MSDN) website. Specifically, here : http://msdn.microsoft.com/library/en-us/off2000/html/ochowchartexamples.asp?frame=true

Cheers.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 11

Expert Comment

by:ASPGuru
Comment Utility
i don't know exactly what you mean with "tilt the data"...
if you want to print the text vertically, i already told you that this isn't possible..

for examples:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dno2kta/html/ofintrowbcom.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dno2kta/html/msowcbasics.asp
0
 
LVL 1

Author Comment

by:ksenthilraj
Comment Utility
Thanks experts,

I changed the graph by other way.. So please  tell  wheather this is possible..

From the recordset different columns i am getting 20,30,40.
I would like to draw the graph in the Y axis one single bar
which contains 20 ,30,40(totally 90) with different colour for 20,30,40..

Is it possible.  I think i am asking too many questions..
Please address this question.

Thanks in advance..

With Cheers

0
 
LVL 11

Expert Comment

by:ASPGuru
Comment Utility
yes, this is possible...

i think this is chChartTypeAreaStacked(30) for the chart type.... or any other stacked chart type - there are some...

lookup ChartChartTypeEnum in MSOWCVBA.CHM...
0
 
LVL 1

Author Comment

by:ksenthilraj
Comment Utility
ASPGuru,

Can you give some link which having the example on this.

or I gave my code above .. give me the modification which

i have to do in that..

Since i am new to OWC I do know this.. In that example i

assign the recordset to the parameter.. If i would like to

give three columns to the same Y axis how to do this.. In

the help file search it gaves only the number 30 alone

nothing more than that..

With Cheers..
0
 
LVL 1

Author Comment

by:ksenthilraj
Comment Utility
dear experts,.

I need some example for the above type of charts.. pls provide

With cheers
0
 
LVL 11

Expert Comment

by:ASPGuru
Comment Utility
create the right chart in excel and puplish the sheet as a web page, then look which property are set...
 t his should give you an idea...

also read the second article i gave you a link to...
0
 
LVL 1

Author Comment

by:ksenthilraj
Comment Utility
Hai,
yes, I will check your link now aspGuru

Thanks
0
 
LVL 1

Author Comment

by:ksenthilraj
Comment Utility
aspGuru,

I tried out your link as well and excel save as method..

In the link very few things only available for the web

type processing of charts.. And there is no examples.

In the case of the save as method in the Excel.. I could

not understand what is happening.. it creates so many

sheets  in a additional folder and stored in that..

These things not clarified my doubts can you help me by

providing a example

With Cheers
0
 
LVL 11

Accepted Solution

by:
ASPGuru earned 30 total points
Comment Utility
is this what you wanted?

<%
'Add a Clustered Column Chart with a legend to the Chartspace
set ChartSpace1 = server.CreateObject("OWC.Chart")

Dim categories(3), values(3)

' Create a column chart with three series and four categories, showing the
' percentage of voters for the 1992 presidential election by race/ethic group.

' Create an array of strings representing the categories.
' The categories will be the same for all three series.
categories(0) = "White"
categories(1) = "Black"
categories(2) = "Asian"
categories(3) = "Latino"

' Clear the contents of the chart workspace. This removes
' any old charts that may already exist and leaves the chart workspace
' completely empty. One chart object is then added.
ChartSpace1.Clear
ChartSpace1.Charts.Add
Set c = ChartSpace1.Constants

' Add three series to the chart.
ChartSpace1.Charts(0).SeriesCollection.Add
ChartSpace1.Charts(0).SeriesCollection.Add
ChartSpace1.Charts(0).SeriesCollection.Add
   
' Series one contains election data for Perot.
' Set the series caption (the text that appears in the legend).
ChartSpace1.Charts(0).SeriesCollection(0).Caption = "Perot"

' Set the categories for the first series (this collection is zero-based)
ChartSpace1.Charts(0).SeriesCollection(0).SetData c.chDimCategories, c.chDataLiteral, categories

values(0) = 0.2 ' The White value.
values(1) = 0.06 ' The Black value.
values(2) = 0.17 ' The Asian value.
values(3) = 0.13 ' The Latino value.

ChartSpace1.Charts(0).SeriesCollection(0).Caption = "Perot"
ChartSpace1.Charts(0).SeriesCollection(0).SetData c.chDimCategories, c.chDataLiteral, categories
ChartSpace1.Charts(0).SeriesCollection(0).SetData c.chDimValues, c.chDataLiteral, values

' Series two contains election data for Clinton.
' Update the values array, then set the chart data.
values(0) = 0.18 ' The White value.
values(1) = 0.32 ' The Black value.
values(2) = 0.28 ' The Asian value.
values(3) = 0.62 ' The Latino value.

ChartSpace1.Charts(0).SeriesCollection(1).Caption = "Clinton"
ChartSpace1.Charts(0).SeriesCollection(1).SetData c.chDimCategories, c.chDataLiteral, categories
ChartSpace1.Charts(0).SeriesCollection(1).SetData c.chDimValues, c.chDataLiteral, values

' Series two contains election data for Bush.
' Update the values array, and then set the chart data.
values(0) = 0.32 ' The White value.
values(1) = 0.12 ' The Black value.
values(2) = 0.15 ' The Asian value.
values(3) = 0.25 ' The Latino value.

ChartSpace1.Charts(0).SeriesCollection(2).Caption = "Bush"
ChartSpace1.Charts(0).SeriesCollection(2).SetData c.chDimCategories, c.chDataLiteral, categories
ChartSpace1.Charts(0).SeriesCollection(2).SetData c.chDimValues, c.chDataLiteral, values

' Make the chart legend visible, format the left value axis as percentage,
' and specify that value gridlines are at 10% intervals.
ChartSpace1.Charts(0).HasLegend = True
ChartSpace1.Charts(0).Axes(c.chAxisPositionLeft).NumberFormat = "0%"
ChartSpace1.Charts(0).Axes(c.chAxisPositionLeft).MajorUnit = 0.1
ChartSpace1.Charts(0).Type = c.chChartTypeColumnStacked

'Save the current chart to a GIF file with a temporary, unique filename
sFullFileName = Server.MapPath(".") & "\test.gif"
chartSpace1.ExportPicture sFullFileName, "gif", 400, 400

'Use On Error Resume Next to make sure we eventually delete
'the temporary GIF file even if something fails in the next couple
'of functions

%>
<img src="test.gif">
0
 
LVL 11

Expert Comment

by:ASPGuru
Comment Utility
> I think this too high for this points
.. if the comments are good then i will increase the points too.

i hope you keep your promise...
0
 
LVL 1

Author Comment

by:ksenthilraj
Comment Utility
ASPGuru,

Just now i saw your reply.. it is really fantastic reply
Guru..

The only thing i need from you I got the things from the database.. How this things will work when i am having my
record set...  

Pls.. clear this point.. even I am not yet gone through your code thoroughly... I would like to give the points to you...

Pls clear my doubt ya..

With Cheers
0
 
LVL 11

Expert Comment

by:ASPGuru
Comment Utility
if the reply is so fantastic, then why you gave only poor 30 points? i thought you want to add more...
0
 
LVL 1

Author Comment

by:ksenthilraj
Comment Utility
how much you want to add... and pls clear that database Datasource for the same method...

I am having three different columns named
column1  column2   column3


In the graph every vertical bar should be the

sum of
  column1+column2+column3..

Using datasource not by defining the array..  I think U understand what i want..

With Cheers
0
 
LVL 1

Author Comment

by:ksenthilraj
Comment Utility
Hai  ASPGuru,

Thanks for your code.. But for your information I already saw this code in the OWC help file.. That's fine.. no issues.. I will give more points to you.. Pls. make this
chart getting information from the database..

I already post a comment regarding this...but no reply from you..

Thanks in advance for you help

With cheers.
0
 
LVL 1

Author Comment

by:ksenthilraj
Comment Utility
ASPGuru,

Are you there??????

With Cheers,
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now