Page 1 of 1
fix increment
Posted: Wed Jul 28, 2010 9:40 pm
by 9644416
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
Re: fix increment
Posted: Thu Jul 29, 2010 10:07 am
by narcis
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.
Re: fix increment
Posted: Thu Jul 29, 2010 9:19 pm
by 9644416
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.
Re: fix increment
Posted: Thu Jul 29, 2010 10:40 pm
by 9644416
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,
Re: fix increment
Posted: Fri Jul 30, 2010 5:01 pm
by yeray
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.
Re: fix increment
Posted: Thu Aug 05, 2010 11:55 pm
by 9644416
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.
Re: fix increment
Posted: Mon Aug 09, 2010 11:47 am
by 10050769
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:
I hope will helps.
Thanks,
Re: fix increment
Posted: Wed Aug 11, 2010 4:47 am
by 9644416
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.
Re: fix increment
Posted: Wed Aug 11, 2010 5:12 am
by 9644416
I forgot to mention that I am using WPF version TeeChart
Re: fix increment
Posted: Wed Aug 11, 2010 11:36 am
by 10050769
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 (168.74 KiB) Viewed 13291 times
Could you please, say us what version of TeeChartWPF you are using currently?
Thanks,
Re: fix increment
Posted: Tue Aug 24, 2010 12:20 am
by 9644416
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?
Re: fix increment
Posted: Wed Aug 25, 2010 1:59 pm
by yeray
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.
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);