Hi,
Would like to know how to set the width of a Mark, so that it represents what I've indicated in the "want-to-have.png" image. Also attached is my current code and a screen shot of what I've currently done. In my third bar or "Column" the Mark text doesn't wrap and goes over the text in column 2 (bar 2).
If there's another way of doing what I want to achieve, please feel free to comment.
Platform is Silverlight, Net 4.0
Thanks
Unique Bargraph
-
- Newbie
- Posts: 6
- Joined: Tue Nov 04, 2014 12:00 am
Unique Bargraph
- Attachments
-
- steema-lithology.zip
- 3 Files: code, what i want to achieve, and what I have screenshot
- (205.79 KiB) Downloaded 782 times
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Unique Bargraph
One suggestion would be the use of Annotation tools, e.g.cjherasmus wrote:If there's another way of doing what I want to achieve, please feel free to comment.
Code: Select all
Steema.TeeChart.Silverlight.Styles.Bar series = new Bar();
Annotation annotation1, annotation2, annotation3;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
tChart1.Panel.Gradient.Visible = false;
tChart1.Walls.Back.Gradient.Visible = false;
tChart1.Panel.Color = Colors.White;
tChart1.Walls.Back.Color = Colors.White;
tChart1.Axes.Bottom.SetMinMax(0, 1);
tChart1.Series.Add(series);
series.Marks.Visible = false;
series.Add(-20, Colors.Orange);
series.Add(-10, Colors.Blue);
series.Add(-30, Colors.Green);
annotation1 = new Annotation(tChart1.Chart);
annotation2 = new Annotation(tChart1.Chart);
annotation3 = new Annotation(tChart1.Chart);
annotation1.Shape.CustomPosition = true;
annotation2.Shape.CustomPosition = true;
annotation3.Shape.CustomPosition = true;
annotation1.Shape.Shadow.Visible = false;
annotation2.Shape.Shadow.Visible = false;
annotation3.Shape.Shadow.Visible = false;
series.MultiBar = MultiBars.SelfStack;
tChart1.AfterDraw +=tChart1_AfterDraw;
tChart1.BeforeDrawSeries += tChart1_BeforeDrawSeries;
}
void tChart1_BeforeDrawSeries(object sender, Graphics3D g)
{
annotation1.Top = series.GetVertAxis.IStartPos;
annotation1.Left = tChart1.Axes.Bottom.CalcXPosValue(1);
annotation1.Height = series.CalcYPos(0) - annotation1.Top;
annotation1.Width = tChart1.Axes.Bottom.CalcXPosValue(2) - annotation1.Left;
annotation1.Text = "Here comes text, here come" + Utils.NewLine + "s text, here comes";
annotation2.Top = series.CalcYPos(0);
annotation2.Left = tChart1.Axes.Bottom.CalcXPosValue(1);
annotation2.Height = series.CalcYPos(1) - annotation2.Top;
annotation2.Width = tChart1.Axes.Bottom.CalcXPosValue(2) - annotation2.Left;
annotation2.Text = "Here comes text, here come" + Utils.NewLine + "s text, here comes";
annotation3.Top = series.CalcYPos(1);
annotation3.Left = tChart1.Axes.Bottom.CalcXPosValue(1);
annotation3.Height = series.CalcYPos(2) - annotation3.Top;
annotation3.Width = tChart1.Axes.Bottom.CalcXPosValue(2) - annotation3.Left;
annotation3.Text = "Here comes text, here come" + Utils.NewLine + "s text, here comes";
}
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |