5 Replies - 1330 Views - Last Post: 23 August 2012 - 10:51 AM Rate Topic: -----

#1 harisharumalla  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 23-August 12

In WPF toolkit chart, can x-axis labels displayed align to tick marks?

Posted 23 August 2012 - 05:58 AM

In WPF toolkit Column series chart, horizontal axis labels are getting displayed in between 2 tick marks. Is it possible to customize it to display to align with tick marks?

I am working on VS 2010 .Net 4.0 using WPF toolkit dlls.

Please let me know the possibility of it?
if possible, please share the way to achieve it.
Is This A Good Question/Topic? 0
  • +

Replies To: In WPF toolkit chart, can x-axis labels displayed align to tick marks?

#2 tlhIn`toq  Icon User is offline

  • Closing in on 5,000
  • member icon

Reputation: 4926
  • View blog
  • Posts: 10,464
  • Joined: 02-June 10

Re: In WPF toolkit chart, can x-axis labels displayed align to tick marks?

Posted 23 August 2012 - 06:32 AM

Can we please see a screenshot of what it looks like, and your markup?
Was This Post Helpful? 0
  • +
  • -

#3 harisharumalla  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 23-August 12

Re: In WPF toolkit chart, can x-axis labels displayed align to tick marks?

Posted 23 August 2012 - 06:57 AM

View PosttlhIn`toq, on 23 August 2012 - 06:32 AM, said:

Can we please see a screenshot of what it looks like, and your markup?


Please find the below code snippet and attached image contains what is happening at present and what to be achieved.

<Window x:Class="WpfToolkitChart.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="1031" Width="855" xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit">
    <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Margin="0,-28,0,28">
        <Grid Height="921">
            
            <chartingToolkit:Chart Height="262" HorizontalAlignment="Left" Margin="33,0,0,585" Name="columnChart" Title="Column Series Demo" VerticalAlignment="Bottom" Width="360">
                <chartingToolkit:ColumnSeries DependentValuePath="Value" IndependentValuePath="Key" ItemsSource="{Binding}"/>
            </chartingToolkit:Chart>



valueList = new List<KeyValuePair<string, int>>();
valueList.Add(new KeyValuePair<string, int>("1", 90));
valueList.Add(new KeyValuePair<string, int>("2", 20));
valueList.Add(new KeyValuePair<string, int>("3", 50));
valueList.Add(new KeyValuePair<string, int>("4", 100));
valueList.Add(new KeyValuePair<string, int>("5", 70));
columnChart.DataContext = valueList;


Attached image(s)

  • Attached Image

Was This Post Helpful? 0
  • +
  • -

#4 tlhIn`toq  Icon User is offline

  • Closing in on 5,000
  • member icon

Reputation: 4926
  • View blog
  • Posts: 10,464
  • Joined: 02-June 10

Re: In WPF toolkit chart, can x-axis labels displayed align to tick marks?

Posted 23 August 2012 - 07:14 AM

Before you go into a frenzy to do this, it might change your mind if you knew how someone else would interpret the data.

The way I read your second example is:
The first column is figures LESS THAN 1
Then you have the divider for 1
The second column is fitures LESS THAN 2
Then you have the divider for 2
...

So you could spend a ton of time writing your own custom draw control, or you could just relable to match the data


|        |       |#######|       |
|        |       |#######|       |
|        |       |#######|       |
|        |       |#######|       |
|########|       |#######|       |
|########|       |#######|       |
|########|       |#######|#######|
|########|       |#######|#######|
|########|       |#######|#######|
|########|#######|#######|#######|
|########|#######|#######|#######|
|   0-1  |  1-2  |  2-3  |  3-4  |

Was This Post Helpful? 0
  • +
  • -

#5 harisharumalla  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 23-August 12

Re: In WPF toolkit chart, can x-axis labels displayed align to tick marks?

Posted 23 August 2012 - 10:21 AM

View PosttlhIn`toq, on 23 August 2012 - 07:14 AM, said:

Before you go into a frenzy to do this, it might change your mind if you knew how someone else would interpret the data.

The way I read your second example is:
The first column is figures LESS THAN 1
Then you have the divider for 1
The second column is fitures LESS THAN 2
Then you have the divider for 2
...

So you could spend a ton of time writing your own custom draw control, or you could just relable to match the data


|        |       |#######|       |
|        |       |#######|       |
|        |       |#######|       |
|        |       |#######|       |
|########|       |#######|       |
|########|       |#######|       |
|########|       |#######|#######|
|########|       |#######|#######|
|########|       |#######|#######|
|########|#######|#######|#######|
|########|#######|#######|#######|
|   0-1  |  1-2  |  2-3  |  3-4  |




Thanks for the quick reply...
Thanks for the representation drawn above.

However my requirement was to display the x-axis labels just below the tick marks. An I would like to know the possibility to achieve the requirement. If yes, then would like to know the way.

If I understand you correctly, it is not possible to achieve it with the WPF toolkit chart control. I may need to create my own control for this requirement instead.

Did I understand correctly?
Was This Post Helpful? 0
  • +
  • -

#6 tlhIn`toq  Icon User is offline

  • Closing in on 5,000
  • member icon

Reputation: 4926
  • View blog
  • Posts: 10,464
  • Joined: 02-June 10

Re: In WPF toolkit chart, can x-axis labels displayed align to tick marks?

Posted 23 August 2012 - 10:51 AM

I'm not saying it can't be done. Just that I've never tried nor did any amount of searching I did find a way. Someone more experienced with WPF might know a way.

I just wanted to present to you a way that your users might interpret the data is the labels under the ticks, and maybe find a way that solved the underlying need without all the time invested.

If your job spec is that you HAVE to do it, then you have to do it.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1