% sign in axis label format

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
UserLS
Advanced
Posts: 247
Joined: Wed May 23, 2007 12:00 am

% sign in axis label format

Post by UserLS » Fri Jan 09, 2009 2:36 pm

What I have noticed, if I choose to use % sign in the label format - all the values are multiplied by 100. Why? I have retrieved all the data I want in the format I need, why you are changing it? And what about graphs, which were saved under prior versions (and did not do it - and therefore, when opened with new program will be 100 times different)? And what about user creates a graph and then just changes the label format? Why should I constantly check the label format and try to come up with a way to fix data, which you have broken?

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

Post by Narcís » Fri Jan 09, 2009 3:02 pm

Hi UserLS,

This doesn't change series data. It's just .NET Framework's Custom Numeric Format Strings that multiplies values when using "%" for formatting strings.

You may achieve what you request like this:

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private void InitializeChart()
		{
			Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);

			bar1.Add(4);
			bar1.Add(5);
			bar1.Add(1);
			bar1.Add(6);
			bar1.Add(2);
			bar1.Add(2);

			bar1.Marks.Visible = true;
			bar1.Marks.Style = Steema.TeeChart.Styles.MarksStyles.Percent;

			tChart1.Axes.Left.Labels.Style = Steema.TeeChart.AxisLabelStyle.Mark;
		}
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

UserLS
Advanced
Posts: 247
Joined: Wed May 23, 2007 12:00 am

Post by UserLS » Fri Jan 09, 2009 6:56 pm

I am not sure, how this should work. My problem is, that we are not talking about one specific chart, I am trying to set up. My users (about 2500 of them) are creating the graphs which may or may not show rate / ratios (this is usually when they want a % sign to show up). First they make all their selections, retrieve data, send it to the charting system. Then they go into chart editor and adjust a few things, so chart looks, as they desire - so they will set the label format, as they have done for years. And yes, from their perspective, you do change the data, since you show different values from the ones they just retrieved! Another scenario - they already have all these graphs created before, and now they just go ahead and print the reports - again, the data in the graph do not correspond to the data in the report next to it - so it is changed! I still do not understand, why by adding one character to the labels format, such a dramatic change should occur.

UserLS
Advanced
Posts: 247
Joined: Wed May 23, 2007 12:00 am

Post by UserLS » Fri Jan 09, 2009 7:04 pm

BTW, first, I could not find in your editor, where I can set Axis.Labels.Style, and second, it is not unusual for our customers to actually show the marks and they have their own opinion, what should be shown there, so sorry, I cannot possibly implement your suggestion. Any other ideas?

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

Post by Narcís » Mon Jan 12, 2009 9:48 am

Hi UserLS,

As I told you before, and as explained in the MSDN link I pointed, it's the .NET Framework that multiplies values for 100 when using "%" character in a custom numeric format string.

In that case the solution I can think of is using the GetSeriesMark and GetAxisLabels events like this:

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private void InitializeChart()
		{
			Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);

			bar1.Add(4);
			bar1.Add(5);
			bar1.Add(1);
			bar1.Add(6);
			bar1.Add(2);
			bar1.Add(2);

			bar1.Marks.Visible = true;

			tChart1.Axes.Left.Labels.ValueFormat = "#.##%";
			bar1.ValueFormat = "#.##%";

			tChart1.GetAxisLabel += new Steema.TeeChart.GetAxisLabelEventHandler(tChart1_GetAxisLabel);
			bar1.GetSeriesMark += new Steema.TeeChart.Styles.Series.GetSeriesMarkEventHandler(bar1_GetSeriesMark);
		}

		void bar1_GetSeriesMark(Steema.TeeChart.Styles.Series series, Steema.TeeChart.Styles.GetSeriesMarkEventArgs e)
		{
			e.MarkText = ParsePercentString(e.MarkText);			
		}

		private string ParsePercentString(string p)
		{
			string tmp = p;

			if ((p.Contains("%")) && (p.Length>1))
			{
				int i = p.IndexOf("%");
				tmp = p.Substring(0, i);
				double val = Convert.ToDouble(tmp);
				val = val / 100;
				tmp = val.ToString() + "%";
			}

			return tmp;
		}

		void tChart1_GetAxisLabel(object sender, Steema.TeeChart.GetAxisLabelEventArgs e)
		{
			e.LabelText = ParsePercentString(e.LabelText);
		}
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

UserLS
Advanced
Posts: 247
Joined: Wed May 23, 2007 12:00 am

Post by UserLS » Mon Jan 12, 2009 2:43 pm

Sorry, the first time I did not realize, it was framework, who played tricks with my data. Good news - all I need to do is to put escape character before the % sign (and fortunately, this setting is controlled by us, so user should not worry about it). We still need a way to hide specific pages from your series editor - especially Data and General, so users will not be able to change the settings, we control.

Thanks for your patience with me!

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

Post by Narcís » Mon Jan 12, 2009 3:01 pm

Hi UserLS,
Sorry, the first time I did not realize, it was framework, who played tricks with my data. Good news - all I need to do is to put escape character before the % sign (and fortunately, this setting is controlled by us, so user should not worry about it).
No problem. I'm glad that you found a solution to the issue.
We still need a way to hide specific pages from your series editor - especially Data and General, so users will not be able to change the settings, we control.
You can do that as shown in the All Features\Welcome !\Components\ChartController\ChartController Editor example at the features demo, available at TeeChart's program group.
Thanks for your patience with me!
You're welcome!
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

UserLS
Advanced
Posts: 247
Joined: Wed May 23, 2007 12:00 am

Post by UserLS » Mon Jan 12, 2009 5:24 pm

Yes, I can actually hide all the main pages on this editor, but what I need, is just series page (and I do not need neither the tab on top, since it is the only one active, nor the combobox, allowing me to switch series). I need to be able to tell it, which series we are editing, so it will select it for me. Next, I need to be able to hide the General page inside the series editor (not the one on the top row of tabs), since it will allow to change settings, which are controlled by our program and we do rely on them not being changed. At last, I need to hide the marks tab - not as if it will break anything in the program, it is just ugly and users will be lost there in a hart beat, and guess what: they will call us (not you). I cannot afford to generate thousands of calls to our customer support just because of pour design of a screen.

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

Post by Narcís » Tue Jan 13, 2009 9:00 am

Hi UserLS,

I'm afraid this is not possible for now unless you are a sourcecode customer and customize ChartEditorTabs and/or the chart editor so it behaves as you need.

You can open the chart editor for a specific series like this:

Code: Select all

			Steema.TeeChart.Editors.SeriesEditor.ShowEditor(line1);
Anyway, I'll add your request to the wish-list to be considered for inclusion on future releases. Also, could you please let us know what would you expect from marks tab?

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

UserLS
Advanced
Posts: 247
Joined: Wed May 23, 2007 12:00 am

Post by UserLS » Tue Jan 13, 2009 2:46 pm

Well, series editor was my first choice, but it does not allow me to hide any tabs, so thanks for adding my request (I hope it will be considered for the next release, since we really need it). Another thing is, it seems to me that in the new release you bring the chart editor with series tab selected instead of just the bottom part of the series tab, which was done in previous releases. So, I am back to almost all of my problems, one of them being that series combo box!

Yes, we do have your code, but I'd rather not change it. In 2001 (or around that time) we've purchased TChart ver4, at the time we had to modify source code, so upgrading to ver5 was a real pain. Then we changed code again and that actually was the reason we could not upgrade anymore, so we were stuck in time with version 5. We do not want to go this route again. I'd rather stay with YOUR latest code, then have my "enhancements" and miss all the good stuff you are doing.

As to marks tab - in general it is a very bad idea to have more than one set of tabs on your screen. This one allows you to get 4 or 5 rows of tabs. Do you really expect people to remember, how they got there? See, you have two types of users. First, us, programmers, who can find anything and understands, how all these controls are working. So, if you were dealing only with us - fine, it's ugly, but works, and it takes a little time to find, what I need, but I'll find it. But then, you have our customers. These are non-computer savvy people (say, they are managing businesses, banks, they have their own field of expertise and computers just help them to perform their jobs). Ok, they need my program to quickly produce reports for a meeting, and they have very limited time. They will not spend it trying to find that one check box, which is who knows on which tab of all these rows! No way! They'll just pick up a phone, and ask our customer support person (and if he/ she does not know it - it's another call to us, developers). Do you think this guy will remember the answer a month later, when he needs it again? I bet - not. So here you have yet another call. And so on. And we have more than 2500 users. I hope you understand my problem. For these people the editors have to be clean and easy to use, and if I know, that my users need only a subset of all the options, you provide, I'd like to show only these options, so user will not be distracted with all the other stuff, he really does not care.

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

Post by Narcís » Tue Jan 13, 2009 3:01 pm

Hi UserLS,

Thanks for your feedback! I've added all that information to the wish-list.
Yes, we do have your code, but I'd rather not change it. In 2001 (or around that time) we've purchased TChart ver4, at the time we had to modify source code, so upgrading to ver5 was a real pain. Then we changed code again and that actually was the reason we could not upgrade anymore, so we were stuck in time with version 5. We do not want to go this route again. I'd rather stay with YOUR latest code, then have my "enhancements" and miss all the good stuff you are doing.
An hybrid approach could be not modifying current TeeChart sources but creating your own custom classes inheriting from existing TeeChart classes.
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

Post Reply