Question Help in OOP!

Jamshid

Member
Joined
Jul 18, 2016
Messages
14
Programming Experience
1-3
Hi there

I'm so confused in c# programming.
I know some about OOP but it doesn't help me!
I'm using DevExpress components and I don't know how to access it's controls' property.
for example bellow diagram is for Radar Chart and I can't customize it's axis
Could you please tell me how to use this diagram in my code?

chart control.png

Thanks in advance
 
Last edited:

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,224
Location
Sydney, Australia
Programming Experience
10+
Your question doesn't really make sense as asked. That diagram appears to lay out a type hierarchy for a Chart control. The blue root node is the control that you add to the UI in your application. That object makes use of the types specified in the orange layer, those types make use of the further types specified in the grey layer and, finally, those types make use of the types specified in the yellow layer.

In order for us to provide more information than that, you're going to have to provide us with more information. Try providing a FULL and CLEAR explanation of your problem. Obviously you haven't just plucked that diagram out of thin air and are trying to use it in some arbitrary way. Explain what it is you're actually trying to achieve and exactly how that diagram figures into it.
 

Jamshid

Member
Joined
Jul 18, 2016
Messages
14
Programming Experience
1-3
Sorry for inexpressive question :adoration:
I'm new to C#.
I thought you know this chart!!! :distant:
I'm using DevExpress components and I'd like to work with it's Charts(Line chart and Radar chart) and Gauge controls.
This picture is Radar chart's classes hierarchy
Clearly my question is this: How can I access for example yellow classes in my code and bind it to the chartcontrol?
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,224
Location
Sydney, Australia
Programming Experience
10+
Have you consulted their documentation? I've never used that control so, if I wanted to learn how to do so, I'd look at the documentation they provide as a starting point.
 

Jamshid

Member
Joined
Jul 18, 2016
Messages
14
Programming Experience
1-3
yes, I have read some documents but can't understand it's syntax
for example: XYDiagram diagram = (XYDiagram)chartControl1.Diagram;
it's for Line chart

I think my problem is OOP. I mean I can't work with classes and objects.
I have watched lot's of videos about OOP but can't use them in real world!
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,224
Location
Sydney, Australia
Programming Experience
10+
yes, I have read some documents but can't understand it's syntax
for example: XYDiagram diagram = (XYDiagram)chartControl1.Diagram;
it's for Line chart

I think my problem is OOP. I mean I can't work with classes and objects.
I have watched lot's of videos about OOP but can't use them in real world!

If that's really the case then you won't be able to write code in C# because it's an OO language. What exactly is your issue with that line of code? Let's address what you're actually confused about.
 

Jamshid

Member
Joined
Jul 18, 2016
Messages
14
Programming Experience
1-3
In OOP I know that we have some classes and when we want to use them, we create objects from those classes.
Class object name = Class();
and then I can use it's methods and properties by '.' :apthy:
How to use objects in hierarchy?
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,224
Location
Sydney, Australia
Programming Experience
10+
OOP is actually very easy because it's modelled on the real world. In the real world, every object has a type and every object is an instance of that type. 'Person' is a type of thing and you and I and everyone else are all instances of that type; we are all person objects. 'Car' is a type of thing and each car is an instance of that type. You could write a C# program and define a Person class and then instantiate it like this:
var person1 = new Person();

person1.Name = "jmcilhinney";

var person2 = new Person();

person2.Name = "Jamshid";

var car = new Car();

car.Make = "Subaru";
car.Model = "Imprezza";

person2.Car = car;

person2.Car.Start();
person2.Car.Drive(person1);
In that code, I am now driving your Subaru Imprezza.
 

Jamshid

Member
Joined
Jul 18, 2016
Messages
14
Programming Experience
1-3
Could you explain the last three line?
at first you made three object (person1, person2 and car) and gave some data to their properties. OK
At line 14 you have wrote "person2.Car = car;", What does it mean (person2.Car)? and how can we assign an object to it?
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,224
Location
Sydney, Australia
Programming Experience
10+
What does it mean (person2.Car)? and how can we assign an object to it?[/FONT]

That code IS assigning an object to it. 'person2.Car' is the Car property of the Person object that the 'person2' variable refers to. If you assume that a person in the real world can have a car then you can consider a Person object to have a Car property. Properties are things an object has, i.e. data, while methods are things an object does, i.e. behaviour. So, if you have two people in the real world, one who has a car and one who doesn't, then they would be represented in code by two Person objects where one of them has its Car property set to null and the other has its Car property set to a Car object. That's exactly what that line of code does, i.e. it assigns a Car object to the Car property of a Person object.
 

Jamshid

Member
Joined
Jul 18, 2016
Messages
14
Programming Experience
1-3
Thanks jmcilhinney
I realized that I don't have deep understanding about objects. I thought that we can't use an object as an attribute and we just can use types like int, byte, string and so on as attributes! Definitely I was wrong. Due to that I couldn't understand this type of coding.

About my question, I was looking for a quick code line that could help me. A code line that shows me how to use this type of classes and solves my problem temporarily!
anyway, thanks for your time and kind help :smug:
 
Top Bottom