How can I change the PrimaryY axis to show text instead of a number or currency? I have it set to go from 1 to 4. Good being 1, Nomal being 2, Bad being 3 and Worst being 4. I want to show a chart that represents those answers based on several different assessments. But 1-4 mean nothing to the user. Is there a format for showing text instead?
Example (except I want to show a different value for each one):
<igCA:XamChart.Axes>
<igCA:Axis AxisType="PrimaryY" Crossing="-1" AutoRange="False" Minimum="1" Maximum="4" Unit="1">
<igCA:Axis.Label>
<igCA:Label Format="{}{0:Text}" FontSize="14" FontWeight="Bold" Foreground="White" />
</igCA:Axis.Label>
</igCA:Axis>
<igCA:Axis AxisType="PrimaryX">
<igCA:Label FontSize="14" FontWeight="Bold" Foreground="White" />
</igCA:XamChart.Axes>
You may be able to get the conversion you want by formatting the Y-axis label with a hard-coded character (like "Y") prefixing the actual value, so that it can be distinguished as a Y-Axis value
...Something like: <igChart:Label Format="Y{0}"/>
Then, handle the LabelAdding event of the XamChart and interrogate the e.Text to determine if it starts with "Y", and if so, change the text based on the second character, which shoul dbe of the set {1,2,3,4}.
private void XamWebChart_LabelAdding(object sender, LabelAddingEventArgs e) { if (e.Text.StartsWith("Y")) { e.Text = e.Text.Substring(1); switch (e.Text) { case "1": e.Text = "Good";
case "2": e.Text = "Normal";
.. //and so on...
..
}
OK, time out, I was giving a solution for the XamWebGrid in Silverlight, which may nto be the best approach for the XamGrid in WPF.
You may be able to bind the Y-axis label to an IValueConverter class and use the Convert method to change the value. Sorry, I had the other code about ready to go for another customer, so I posted it for you. I don't yet have a sample for this in WPF.
Hi
Could you give some example code for how this binding would work in the WPF case?
Thanks
Hi,
I don't believe you currently have the necessary hooks to convert these values to strings in the WPF xamChart. Which series type are you using? Have you considered using the xamDataChart? You have more flexibility as to how you format and display the axis labels with that control.
-Graham
IDK about him but I am using a lot of different types. I use Cylinder, Column, Point, Line, etc. I also give an option for the user to change the chart type to whatever they want. Does the datachart work in the same way? I hate to go changing all the logic now. I have a lot of charts. Does it allow you to display in 3D? I also allow the user to rotate and zoom in on the charts. And I specify tooltips for each bar so that they can hover over and get some additional information. Are all those features available on the datachart and how hard would it be to change it without losing all that functionality and existing code? Why would there not be a Label_Added event anyways? That idea of replacing the text was a great idea. Too bad there is no such event to listen for.
Given your situation, I believe you would be best off making a feature request to have an event like Label_Added introduced for the WPF xamChart. The xamDataChart does not yet support any 3D chart types, if you are utilizing those. Also, the current set of supported series types is different than xamChart, so if you are using types that aren't currently supported in xamDataChart you would have to analyze the tradeoffs. The API has also evolved for the new chart, so if you are doing things like allowing for the dynamic configuration of charts, there would be some effort required in shifting to using the xamDataChart.
You can examine which series types are currently supported for the xamDataChart here: http://help.infragistics.com/NetAdvantage/WPFDV/2010.2/CLR4.0/?page=xamDataChart_Series_Types.html
But yes, if you have a lot of existing development tied to xamChart's API, you may be better of with a feature allowing you to accomplish this against the xamChart.
I would love to suggest a public Label_Added event. Do you happen to know where I go to suggest that? I couldn't find a section for feature requests anywhere on the Infragistics site. Should I just send an email to support or is there a designated area for this?