Solved

Office Web Component Commands

Posted on 2001-06-15
29
807 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 14
  • 10
  • 4
  • +1
29 Comments
 
LVL 15

Expert Comment

by:ozymandias
ID: 6194506
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
ID: 6194646
sorry, not possible...
0
 
LVL 1

Author Comment

by:ksenthilraj
ID: 6194943
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:ksenthilraj
ID: 6194963
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
ID: 6195110
> 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
ID: 6195230
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
ID: 6195896
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
ID: 6195969
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
ID: 6196513
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
ID: 6197455
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
ID: 6197735
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
ID: 6198250
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
ID: 6226643
Dear Experts,

No reply..   Any comments..

WIth Cheers
0
 
LVL 15

Expert Comment

by:ozymandias
ID: 6227141
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
 
LVL 11

Expert Comment

by:ASPGuru
ID: 6227146
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
ID: 6229969
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
ID: 6230093
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
ID: 6230138
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
ID: 6237055
dear experts,.

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

With cheers
0
 
LVL 11

Expert Comment

by:ASPGuru
ID: 6237125
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
ID: 6237171
Hai,
yes, I will check your link now aspGuru

Thanks
0
 
LVL 1

Author Comment

by:ksenthilraj
ID: 6237504
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
ID: 6237774
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
ID: 6237831
> 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
ID: 6240508
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
ID: 6240523
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
ID: 6240554
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
ID: 6240672
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
ID: 6247477
ASPGuru,

Are you there??????

With Cheers,
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MS SQL and column defined as time 7 36
How to post data to an API using ASP Classic 3 51
Making Table Thru ASP Response.write 5 38
JQuery on multiple lines 3 49
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

751 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