?
Solved

vb Mschart Rotate et Size ( urgent )

Posted on 2003-02-25
17
Medium Priority
?
481 Views
Last Modified: 2007-12-19
Hi experts
here are my 2 questions

1- i need to rotate my Axis. I'm not sure what exactly the words are. I think its AXIS. On the rigth and left of the chart, i got the percentages = 10 , 20 , 30 ...
i need to rotate them like this when i rotate my sheet, there straigth

2- I'm using 2dbars and i want to make my BARS smaller size, the .width is too big, how can i change that


this is an urgent questions, i really need your help and fast plz

i would really appreciate and fast answer
thx
Italbro
0
Comment
Question by:Italbro5
[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
  • 9
  • 8
17 Comments
 

Author Comment

by:Italbro5
ID: 8016686
oh ya.
forgot to tell you this.
i dont know if it will make a difference

but i'm using this to create my charts.

Set cmdObject = Form3.Controls.Add("MSChart20Lib.MSChart", "achart" + Trim(Str(n + 1)))

0
 
LVL 1

Expert Comment

by:HarmnKardn
ID: 8016994
If you didn't already know, right clicking the chart control and choosing "properties" brings up a properties dialog box that lets you adjust the most important visual aspects of your chart control.
0
 

Author Comment

by:Italbro5
ID: 8017126
HarmnKardn
i create then dynamicly so i cant rigth click on it
lol
thx
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

Expert Comment

by:HarmnKardn
ID: 8017363
Silly me.

Then (if you haven't already looked), the achart.Plot.* properties are what you want to look at.  Check out MSDN for a link of which plot properties do what:

http://msdn.microsoft.com/library/en-us/mschrt/html/vbobjplotobjectpme.asp
0
 
LVL 1

Expert Comment

by:HarmnKardn
ID: 8017394
As for 1), I'm not sure what you exactly mean by "rotate"...could you elaborate.

For 2), it looks as though increasing achart.Plot.BarGap will decrease the width of the bars, and vice-versa.
0
 

Author Comment

by:Italbro5
ID: 8017397
I'm gonna check but if you know
wich one i should work  for

#1 and #2
0
 

Author Comment

by:Italbro5
ID: 8017761
as for 1),

the Axis Y as a scale

90

80

70

60

....

now the thing is i need to rotate those number. TO change there oriantation.
0
 

Author Comment

by:Italbro5
ID: 8017933
HarmnKardn

you know an other then
Set cmdObject = Form3.Controls.Add("MSChart20Lib.MSChart", "achart" + Trim(Str(n + 1)))

cause if i do
with cmdObject
end with

if i do : . Something
it dosent work
the properties dont come if i press " . " and if i write
cmdObject.Plot.BarGap = 20 wont work

but if i create an MsChart1
and then do
MsChart1.Plot.BarGap = 20, this will work
how come
0
 
LVL 1

Expert Comment

by:HarmnKardn
ID: 8017974
What type exactly is "cmdObject"?  Is it a command button?  I couldn't figure out your syntax, when you were calling "set" on it.  Are you dynamically creating the command button and attaching a directive to it somehow?  I've never actually seen that done before.
0
 

Author Comment

by:Italbro5
ID: 8018105
Set cmdObject = Form3.Controls.Add("MSChart20Lib.MSChart", "achart" + Trim(Str(n + 1)))

i create an MsChart dynamicly
thats how its done


is there an other way ??

cmdObject is the name i give to it
i can do it like that :

Set oChart = Form3.Controls.Add("MSChart20Lib.MSChart", "achart" + Trim(Str(n + 1)))

it will do the same thing
after i can do

oChart.visible = true  // this will work
but when i write oChart. // it dosent show the different properties i can use

0
 
LVL 1

Accepted Solution

by:
HarmnKardn earned 150 total points
ID: 8018121
At any rate, you probably want to do something like

Form3.Controls.achart1.Plot.BarGap = 20
Form3.Controls.achart2.Plot.BarGap = 20
Form3.Controls.achart3.Plot.BarGap = 20
Form3.Controls.achart4.Plot.BarGap = 20

Or, more elegantly, dynamically create one chart object, set the plot properties as you like, and then instantiate new chart objects, setting them equal to the formatted one you just created (or just copy the .Plot object).  After you've created your 4 chart objects, they would be formatted, and all you have to do is put data in them.
0
 
LVL 1

Expert Comment

by:HarmnKardn
ID: 8018264
oChart is just an object returned from that call that adds the chart to the controls container on the form (thus giving you the power to dynamically name the control).

If you name the charts explicitly in your code, you can just do "Dim bChart As MSChart20Lib.MSChart" and do whatever you'd like with it.  Otherwise, to manipulate the chart, you should do so by interacting through the Form.Controls container, as above.
0
 

Author Comment

by:Italbro5
ID: 8018474
HarmnKardn
nothing works

if i do : Dim bChart As MSChart20Lib.MSChart

it works but dosent create a new one
and
if i do
with bChart

end with

gives me an error
nothing workds with that stupid ****
4 days i've been spending on properties when MsChart added dynamicly, nothing works

i really need your help
thx
0
 
LVL 1

Expert Comment

by:HarmnKardn
ID: 8019792
I made a project and got the following code working:

Public oChart As Object
Private n As Integer

Private Sub Command1_Click()
    Set oChart = Me.Controls.Add("MSChart20Lib.MSChart", "aChart" + Trim(Str(n + 1)))
    oChart.Height = Me.Height
    oChart.Width = Me.Width
    oChart.Visible = True
    oChart.Plot.BarGap = 100
    n = n + 1
End Sub


Basically, the reason why you can't see the properties of the oChart object directly is because the IDE doesn't tokenize your code enough during development time to understand that oChart is an MSChart and not an "Object".  Just make sure you scope those chart objects accordingly.

Ignore what I had said about using "Dim" to instantiate an instance...it doesn't seem to be happy with the MSChart.  MSChart doesn't let you use "new" to allocate memory for it, so it's all pretty shady.

Also, setting the .Plot object of one chart equal to another just doesn't work...I tried this with the "set" directive and without...just wouldn't do it.  You'll have to set the .Plot property of each chart object seperately.
0
 

Author Comment

by:Italbro5
ID: 8025107
HarmnKardn :

so there is no way i can do this then
i got read a file and create a # of chart
so i'm screwed then , is that it ??
0
 
LVL 1

Expert Comment

by:HarmnKardn
ID: 8025637
I'm thinking you might want to make some architectural changes to your project to do what you're looking to do.  First of all, make a new form (call it frmChart) and drop a chart control onto it (MSChart1).  Size and position it the way you want, format it, and such.

Now, organize your code so that when you parse the text file, you create a new window for each chart you want to create.  Dynamically creating form objects is much more elegant then trying to manage a metric assload of charts on a single form.

After that, every time you need to make a form, you do it dynamically, then consult the frmChartXXXX.MSChart1 to set your data and do whatever is necessary on it.

You should be able to do this.  I've created multiple forms to dynamically create a four charts using (Dim chartOne as frmChart) statements...that worked fine for me.  I've never seen it done for a dynamic number of charts before, but I think it should work making them as forms.
0
 

Author Comment

by:Italbro5
ID: 8041268
Its half of what i wanted but it still good
thx anyways
Italbro
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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month14 days, 16 hours left to enroll

770 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