• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 836
  • Last Modified:

Office Web Component Commands

<%
'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
ksenthilraj
Asked:
ksenthilraj
  • 14
  • 10
  • 4
  • +1
1 Solution
 
ozymandiasCommented:
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
 
ASPGuruCommented:
sorry, not possible...
0
 
ksenthilrajAuthor Commented:
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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
ksenthilrajAuthor Commented:
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
 
ASPGuruCommented:
> 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
 
ozymandiasCommented:
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
 
pclaypoolCommented:
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
 
ozymandiasCommented:
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
 
ASPGuruCommented:
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
 
ksenthilrajAuthor Commented:
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
 
ASPGuruCommented:
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
 
ksenthilrajAuthor Commented:
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
 
ksenthilrajAuthor Commented:
Dear Experts,

No reply..   Any comments..

WIth Cheers
0
 
ozymandiasCommented:
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
 
ASPGuruCommented:
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
 
ksenthilrajAuthor Commented:
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
 
ASPGuruCommented:
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
 
ksenthilrajAuthor Commented:
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
 
ksenthilrajAuthor Commented:
dear experts,.

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

With cheers
0
 
ASPGuruCommented:
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
 
ksenthilrajAuthor Commented:
Hai,
yes, I will check your link now aspGuru

Thanks
0
 
ksenthilrajAuthor Commented:
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
 
ASPGuruCommented:
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
 
ASPGuruCommented:
> 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
 
ksenthilrajAuthor Commented:
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
 
ASPGuruCommented:
if the reply is so fantastic, then why you gave only poor 30 points? i thought you want to add more...
0
 
ksenthilrajAuthor Commented:
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
 
ksenthilrajAuthor Commented:
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
 
ksenthilrajAuthor Commented:
ASPGuru,

Are you there??????

With Cheers,
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 14
  • 10
  • 4
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now