fix increment

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
tenaris
Newbie
Newbie
Posts: 39
Joined: Fri Mar 02, 2007 12:00 am

fix increment

Post by tenaris » Wed Jul 28, 2010 9:40 pm

Hi

It could be possible to fix (in the drawing) the increment in the right axe?
I need that each increment are equal in pixels, or points, etc.
I need to put a tabular data next to the graph, each row of the tabular data is one increment in the right axe.

Thanks

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: fix increment

Post by Narcís » Thu Jul 29, 2010 10:07 am

Hi tenaris,

Yes, you can use axis Increment property. Please read tutorial 4, which can be found at TeeChart's program group, for further information on axis settings.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

tenaris
Newbie
Newbie
Posts: 39
Joined: Fri Mar 02, 2007 12:00 am

Re: fix increment

Post by tenaris » Thu Jul 29, 2010 9:19 pm

Thanks for reply.

But that I need, is set the same distance between each ticks in pixels.

I want to create a graph dinamically next to a tabular data, and I need that each row of the tabular data are in the same line at the graphic ticks.


.......................Tabular Data.............................................................Graph

Name............Value a........Value b
element 1.......2...............5................................1---| #########
.......................................................................X |
element 2.......4...............2.................................2--| ###########
.........................................................................|
element 3.......1...............2.................................3--| ###########
.........................................................................|
element 4.......3...............4................................4---| #######
...................................................................... --|
...................................................................... ---|
eleemnt n..........................................................n---| ##########
.......................................................................... __________________________________________________________
...................................................................................|.........|...........|..........|..........|...........|............|

(the dots are blanks, if you do not understand, i could send a image)

I want to fix x in 25 pixels for example. Don´t matter if I have 5 or 15 element, I want that x have the same 25 pixels.

tenaris
Newbie
Newbie
Posts: 39
Joined: Fri Mar 02, 2007 12:00 am

Re: fix increment

Post by tenaris » Thu Jul 29, 2010 10:40 pm

This is the image

The idea is that each pair of gantt graph bars staying in the same line of their corresponding row of the tabular data for any number of elements.

In this example I have 12 elements, and x have one value.
I need that x has the same value If there are 5 or 15 elements,
Attachments
graph.JPG
graph.JPG (52.65 KiB) Viewed 13483 times

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: fix increment

Post by Yeray » Fri Jul 30, 2010 5:01 pm

Hi tenaris,

Thanks for the picture and the explanation but I'm afraid I'm still not sure to understand what are you exactly trying to achieve.
If you want the right axis to always have the same minimum and maximum regardless of the number of gantts you have, you can call SetMinMax function.
If you still find problems with it, please try to arrange a simple example project we can run as-is to reproduce the problem here.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

tenaris
Newbie
Newbie
Posts: 39
Joined: Fri Mar 02, 2007 12:00 am

Re: fix increment

Post by tenaris » Thu Aug 05, 2010 11:55 pm

Thanks for reply
I think I understood your suggestion, I'm going check it later.

I got two new questions:
1. It's possible eliminate the labels in the left axe without eliminate the thicks and grid?
2. It's possible reduce de height of the bars in graphics gantt?

If it is possible, how can I do that?

Thanks in advance.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: fix increment

Post by Sandra » Mon Aug 09, 2010 11:47 am

Hello tenaris,
1. It's possible eliminate the labels in the left axe without eliminate the thicks and grid?
Yes it is possible. You have two ways:

First: using Custom labels:

Code: Select all

 private Steema.TeeChart.Styles.Line lineser;
               private void InitializeChart()
               {
                   lineser = new Steema.TeeChart.Styles.Line(tChart1.Chart);
                   lineser.FillSampleValues();
                   //clear text list for clipboard copy
                   tChart1.Legend.Visible=false;
                   tChart1.Axes.Left.Labels.Items.Clear();
                   for (int i = 0; i < lineser.Count; i++)
                   {
                       tChart1.Axes.Left.Labels.Items.Add(lineser[i].Y, " "); //could set spaces to length of orig text
                   }
                   
               }
Second: Using GetAxisDrawLabel

Code: Select all

 private Steema.TeeChart.Styles.Line lineser;
               private void InitializeChart()
               {
                   lineser = new Steema.TeeChart.Styles.Line(tChart1.Chart);
                   lineser.FillSampleValues();
                  tChart1.Axes.Left.GetAxisDrawLabel += new Steema.TeeChart.GetAxisDrawLabelEventHandler(Left_GetAxisDrawLabel);
               }

               void Left_GetAxisDrawLabel(object sender, Steema.TeeChart.GetAxisDrawLabelEventArgs e)
               {
                   tChart1.Axes.Left.Labels.Items.Clear();
                   e.Text = " ";
               }
In two ways are necessary use empty strings, because if you only clear items ticks and grid don't appear
2. It's possible reduce de height of the bars in graphics gantt?
Yes. You could use series.pointer.VertSize property as next lines:

Code: Select all

  gantt.Pointer.VertSize = 5;
I hope will helps.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

tenaris
Newbie
Newbie
Posts: 39
Joined: Fri Mar 02, 2007 12:00 am

Re: fix increment

Post by tenaris » Wed Aug 11, 2010 4:47 am

Thanks for reply

I had success in reduce the height of the bars in graphics gantt, but I couldn´t eliminate the labels in the left axe without eliminate the thicks and grid. I wrote the first code and grids and thicks were eliminated

I'm doing wrong?

Thanks in advance.
Attachments
Gráfico1.jpg
Gráfico1.jpg (41.43 KiB) Viewed 13407 times

tenaris
Newbie
Newbie
Posts: 39
Joined: Fri Mar 02, 2007 12:00 am

Re: fix increment

Post by tenaris » Wed Aug 11, 2010 5:12 am

I forgot to mention that I am using WPF version TeeChart

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: fix increment

Post by Sandra » Wed Aug 11, 2010 11:36 am

Hello tenaris,

I couldn't reproduce your problem using previous code with last version of TeeChart.WPF and I have get next image, where grid and ticks of left axis, still appears.
imageWPF1.JPG
imageWPF1.JPG (168.74 KiB) Viewed 13512 times
Could you please, say us what version of TeeChartWPF you are using currently?

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

tenaris
Newbie
Newbie
Posts: 39
Joined: Fri Mar 02, 2007 12:00 am

Re: fix increment

Post by tenaris » Tue Aug 24, 2010 12:20 am

Thanks

It worked out. I was doing wrong.

But settig labels with blank spaces doesn't solve my problem.

I need my panel not to have margin on the left side. And it's only possible if I remove the labels at the left axis (that includes the grid, and I don´t want to remove it). is It correct?
One alternative could be:

To draw lines that simulate the grid.
could it be possible?

I thought this because I need a tool tip in my gantt bar when the mouse is over it, and I do it this way:

Code: Select all

gantt1.Add(dIni, dFin, 5.45, "Statistical\nElement:\t\tPressure Time\nBegin Date:\t1 jun 2010", Color.FromRgb(204, 0, 102));
When I do that, the labels in the left axis are very big, and the space between the axis and the begining of the panel is very big too. That's why I need to remove the labels,
and that is why I thought to draw lines like rows. (see figure 1 -the red lines-)

My questions are
1.-Is it possible to eliminate the space between the beginning of the panel and the left axis?
2.-Is it possible to draw lines like rows in figure 1 and lines like fixed values (see figure 2)?
3.-Is the way i´m using the tool tip correct?
Attachments
Gráfico1w.jpg
Gráfico1w.jpg (113.56 KiB) Viewed 13357 times

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: fix increment

Post by Yeray » Wed Aug 25, 2010 1:59 pm

Hi tenaris,
tenaris wrote:1.-Is it possible to eliminate the space between the beginning of the panel and the left axis?
You can remove the MarginLeft as follows.

Code: Select all

tChart1.Panel.MarginLeft = 0;
tenaris wrote:2.-Is it possible to draw lines like rows in figure 1 and lines like fixed values (see figure 2)?
If you want to remove also the labels, maintaining the grids, you should implement one of the solutions Sandra proposed above.
Another option could be drawing manually lines where you want.
I've tested the three with this example. Uncomment the option you would like to try. The three look fine for me here.

Code: Select all

        public MainWindow()
        {
            InitializeComponent();

            InitializeChart();
        }

        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            tChart1.Legend.Visible = false;

            new Steema.TeeChart.WPF.Styles.Gantt(tChart1.Chart);
            tChart1[0].FillSampleValues(5);

            tChart1.Panel.MarginUnits = Steema.TeeChart.WPF.PanelMarginUnits.Pixels;
            tChart1.Panel.MarginLeft = 0;

            //Option1: Custom Labels
                tChart1.Axes.Left.Labels.Items.Clear();
                for (int i = 0; i < tChart1[0].Count; i++)
                {
                    tChart1.Axes.Left.Labels.Items.Add(tChart1[0].YValues[i], "");
                }
                tChart1.Axes.Left.Ticks.Visible = false;
                tChart1.Axes.Left.MinorTicks.Visible = false;

            //Option2: OnGetAxisLabel event
                //tChart1.Axes.Left.Ticks.Visible = false;
                //tChart1.Axes.Left.MinorTicks.Visible = false;
                //tChart1.GetAxisLabel += new Steema.TeeChart.WPF.GetAxisLabelEventHandler(tChart1_GetAxisLabel);

            //Option3: Manual drawing
                //tChart1.Axes.Left.Labels.Visible = false;
                //tChart1.BeforeDrawSeries += new Steema.TeeChart.WPF.PaintChartEventHandler(tChart1_BeforeDrawSeries);
        }

        //Option2: OnGetAxisLabel event
        void tChart1_GetAxisLabel(object sender, Steema.TeeChart.WPF.GetAxisLabelEventArgs e)
        {
            if (sender == tChart1.Axes.Left)
                e.LabelText = " ";
        }

        //Option3: Manual drawing
        void tChart1_BeforeDrawSeries(object sender, Steema.TeeChart.WPF.Drawing.Graphics3D g)
        {
            for (int i = 0; i < tChart1[0].Count; i++)
            {
                double YVal = tChart1[0].YValues[i];

                Point P0 = new Point(tChart1.Axes.Bottom.IStartPos, tChart1.Axes.Left.CalcPosValue(YVal));
                Point P1 = new Point(tChart1.Axes.Bottom.IEndPos, tChart1.Axes.Left.CalcPosValue(YVal));

                g.Pen.Color = tChart1.Axes.Left.Grid.Color;
                g.Pen.Style = DashStyles.Dash;
                g.Line(P0, P1);
            }
        }
tenaris wrote:3.-Is the way i´m using the tool tip correct?
Addign the following to the example above, everything seems to work as expected:

Code: Select all

            DateTime dIni, dFin;
            dIni = DateTime.Today;
            dFin = DateTime.Today.AddDays(4);
            gantt1.Add(dIni, dFin, 5.45, "Statistical\nElement:\t\tPressure Time\nBegin Date:\t1 jun 2010", Color.FromRgb(204, 0, 102));

            Steema.TeeChart.WPF.Tools.MarksTip tool1 = new Steema.TeeChart.WPF.Tools.MarksTip(tChart1.Chart);
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply