Page 1 of 1
Axis labels within the bar rectangle?
Posted: Wed Aug 10, 2016 5:24 pm
by 15677721
Is there a way to display the data item label within the bar rectangle like this? (Please excuse my ASCII art...)
Code: Select all
-----------------------------------------------------
Item 1 |
-----------------------------------------------------
-----------------------------------------------
Item 2 |
-----------------------------------------------
---------------------------------------------------------
Item 3 |
---------------------------------------------------------
Re: Axis labels within the bar rectangle?
Posted: Thu Aug 11, 2016 12:18 pm
by 10050769
Hello t-chizzle,
You can use the MarksOnBar to draw the bar in your end. The code below shows you how:
Code: Select all
Steema.TeeChart.Styles.HorizBar horizbar;
private void InitializeChart()
{
horizbar = new Steema.TeeChart.Styles.HorizBar(tChart1.Chart);
horizbar.FillSampleValues(3);
horizbar.CustomBarWidth = 50;
horizbar.MarksOnBar = true;
horizbar.MarksLocation = Steema.TeeChart.Styles.MarksLocation.Start;
}
Thanks in advance
Re: Axis labels within the bar rectangle?
Posted: Fri Aug 12, 2016 9:57 am
by 15677721
Thanks Sandra. That seems to sort basically sort it, but in my use case there is an issue that you should be able to see from the attached image.
The min and max are set to 0 and 120, but he graph is resized as if the marks are attached to the edge of the bar. When the label is longer than the screen the data entirely disappears.
Is there a way around this?
Re: Axis labels within the bar rectangle?
Posted: Fri Aug 12, 2016 2:07 pm
by 10050769
Hello t-chizzle,
Marks are split in lines when you choose a "compound" mark style like: MarksStyles.LabelPercent, MarksStyles.LabelPercentTotal or MarksStyles.XY.
You can also make marks having multiple lines adding line breaks into them, for example:
Code: Select all
private void InitializeChart()
{
horizbar = new Steema.TeeChart.Styles.HorizBar(tChart1.Chart);
Random rnd = new Random();
horizbar.Add(10, 50,"Name");
horizbar.Add(20, 70, "Short\n Name");
horizbar.Add(50, 30, "Very long name that \n causes some problems");
horizbar.CustomBarWidth = 50;
horizbar.MarksOnBar = true;
horizbar.Marks.Transparent = true;
horizbar.Marks.MultiLine = true;
horizbar.MarksLocation = Steema.TeeChart.Styles.MarksLocation.Start;
tChart1.Axes.Left.Labels.Style = Steema.TeeChart.AxisLabelStyle.Value;
tChart1.Axes.Left.Inverted = false;
Using GetMarkText event you can automatically parse marks text too. You could replace blank spaces for line brakes or implement any customization you wish.
Thanks in advance,
Re: Axis labels within the bar rectangle?
Posted: Fri Aug 12, 2016 3:08 pm
by 15677721
Hi Sandra,
I don't think the problem is due to not being able to split the labels. The problem is that the size of the bar shrinks as the length of the mark grows. This makes sense when the label is on the end of the bar, but when it's at the beginning it's the wrong thing to do. In the image above, if I don't use a mark the axis is 0 -> 120 and the red value goes all the way to the end.
The extra whitespace at the end is the length of the largest mark. The end of the bar moves left as if it was allowing space for the mark to be drawn on the end.
Thanks
Re: Axis labels within the bar rectangle?
Posted: Fri Aug 12, 2016 3:17 pm
by 10050769
Hello t-Chizzle,
Could you attach the simple project you're using because we can reproduce exactly the problem here?
Thanks in advance for your help,
Re: Axis labels within the bar rectangle?
Posted: Fri Aug 12, 2016 3:37 pm
by 15677721
Hi Sandra,
I made a demo project that you can find here:
https://www.dropbox.com/s/7ech6qvgnihap ... o.zip?dl=0
Thanks
Re: Axis labels within the bar rectangle?
Posted: Wed Aug 17, 2016 11:48 am
by 15677721
Hi Sandra, have you had a chance to look into this any further?
Thanks in advance
Re: Axis labels within the bar rectangle?
Posted: Wed Aug 17, 2016 12:48 pm
by 10050769
Hello t-Chizzle,
I would like inform, we have made some changes in our source code to fix the problem you're experiencing. We have gotten the results below:
- ChartMarksOnBar.jpg (73.21 KiB) Viewed 24626 times
Could you confirm if the above results are what you expect?
Thanks in advance for your help
Re: Axis labels within the bar rectangle?
Posted: Wed Aug 17, 2016 2:26 pm
by 15677721
Hi Sandra,
That looks perfect, thank you very much.
Re: Axis labels within the bar rectangle?
Posted: Thu Aug 18, 2016 9:25 am
by 15677721
Hi Sandra,
How do I get the updated dll?
Thanks
Re: Axis labels within the bar rectangle?
Posted: Thu Aug 18, 2016 12:51 pm
by 10050769
Hello t-chizzle,
How do I get the updated dll?
We will prepare for you a Teechart.dll.
Could you tell us in which version you are working(specifying .Net Framework).
Also, could you tell us if you want TeeChart.dll signed or unsigned?
Thanks in advance
Re: Axis labels within the bar rectangle?
Posted: Thu Aug 18, 2016 2:04 pm
by 15677721
Hi Sandra,
I'm using the dll that lives in this directory: Steema TeeChart for .NET 2015 4.1.2015.12160\net45\x86
I guess that means .net 45, x86, signed.
Thanks
Re: Axis labels within the bar rectangle?
Posted: Fri Aug 19, 2016 8:18 am
by 10050769
Hello t-chizzle,
I have sent you an email with information.
Thanks in advance,