Axis labels within the bar rectangle?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
t-chizzle
Newbie
Newbie
Posts: 13
Joined: Fri Feb 19, 2016 12:00 am

Axis labels within the bar rectangle?

Post by t-chizzle » Wed Aug 10, 2016 5:24 pm

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                                                  |
---------------------------------------------------------

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

Re: Axis labels within the bar rectangle?

Post by Sandra » Thu Aug 11, 2016 12:18 pm

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
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

t-chizzle
Newbie
Newbie
Posts: 13
Joined: Fri Feb 19, 2016 12:00 am

Re: Axis labels within the bar rectangle?

Post by t-chizzle » Fri Aug 12, 2016 9:57 am

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?
Attachments
long-label.png
long-label.png (13.7 KiB) Viewed 24714 times

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

Re: Axis labels within the bar rectangle?

Post by Sandra » Fri Aug 12, 2016 2:07 pm

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,
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

t-chizzle
Newbie
Newbie
Posts: 13
Joined: Fri Feb 19, 2016 12:00 am

Re: Axis labels within the bar rectangle?

Post by t-chizzle » Fri Aug 12, 2016 3:08 pm

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

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

Re: Axis labels within the bar rectangle?

Post by Sandra » Fri Aug 12, 2016 3:17 pm

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,
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

t-chizzle
Newbie
Newbie
Posts: 13
Joined: Fri Feb 19, 2016 12:00 am

Re: Axis labels within the bar rectangle?

Post by t-chizzle » Fri Aug 12, 2016 3:37 pm

Hi Sandra,
I made a demo project that you can find here: https://www.dropbox.com/s/7ech6qvgnihap ... o.zip?dl=0
Thanks

t-chizzle
Newbie
Newbie
Posts: 13
Joined: Fri Feb 19, 2016 12:00 am

Re: Axis labels within the bar rectangle?

Post by t-chizzle » Wed Aug 17, 2016 11:48 am

Hi Sandra, have you had a chance to look into this any further?

Thanks in advance

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

Re: Axis labels within the bar rectangle?

Post by Sandra » Wed Aug 17, 2016 12:48 pm

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
ChartMarksOnBar.jpg (73.21 KiB) Viewed 24631 times
Could you confirm if the above results are what you expect?

Thanks in advance for your help
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

t-chizzle
Newbie
Newbie
Posts: 13
Joined: Fri Feb 19, 2016 12:00 am

Re: Axis labels within the bar rectangle?

Post by t-chizzle » Wed Aug 17, 2016 2:26 pm

Hi Sandra,
That looks perfect, thank you very much.

t-chizzle
Newbie
Newbie
Posts: 13
Joined: Fri Feb 19, 2016 12:00 am

Re: Axis labels within the bar rectangle?

Post by t-chizzle » Thu Aug 18, 2016 9:25 am

Hi Sandra,
How do I get the updated dll?
Thanks

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

Re: Axis labels within the bar rectangle?

Post by Sandra » Thu Aug 18, 2016 12:51 pm

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
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

t-chizzle
Newbie
Newbie
Posts: 13
Joined: Fri Feb 19, 2016 12:00 am

Re: Axis labels within the bar rectangle?

Post by t-chizzle » Thu Aug 18, 2016 2:04 pm

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

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

Re: Axis labels within the bar rectangle?

Post by Sandra » Fri Aug 19, 2016 8:18 am

Hello t-chizzle,

I have sent you an email with information.

Thanks in advance,
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

Post Reply