Hi Team,
public class Service{
public string ServiceName{get;set;}
public string List {get;set;}
}
In which each service has a list of reports.Report structure is as below
public class Report{
public string ReportName{get;set;}
public int density{get;set;}
On X axis i wanted the service name that has list of report bars grouped together with the same colour of service, report bars are based on density value.
on xaxis service names should show up.
on report bars on the tooltip report name should be displayed
In simple words i wanted to display all the reports under services.But all services under a report should have the same colour and must be grouped.Also attached the screen shot of the requirement i need.
Tried the same way but it is not working as expected
Waiting for your help on this.Thanks in advance for all you do
Regards.
Sridhar
In the above mentioned structure the Service class is as follows.
Public class service
{
Public string service name{get;set;}
Public List<Report> Reports{get;set;}
Hello Sridhar,
Thank you for your post(s).
Unfortunately, this is not the way that the XamDataChart works with its ColumnSeries elements. The amount of ColumnSeries used for a particular category on the axis depends on the number of ColumnSeries elements that you have in your XamDataChart.Series collection, and for this to work, you would need a separate ValueMemberPath for each of the column series so that you could "group" by the services in your chart.
For your requirement to work, I would recommend having a separate class, or perhaps a DataTable with the number of value-properties (or columns) equal to the maximum number of reports in one of your services. Using this, you can have X number of ColumnSeries in your XamDataChart, where X is that number of value-properties or columns. For the "services" that don't have the maximum amount of reports, you can set the value for those reports to "0" or "null" if you use a nullable type, and the columns for that particular service will not show for the values that are null or 0, assuming you set the MinimumValue of your NumericYAxis to 0.
What this will do, is it will allow you to have multiple columns in your chart existing for each service in the chart. The issue now, is that each of these columns will be a different color for that particular service. This issue can be eliminated by handling the AssigningCategoryStyle event of the ColumnSeries. This allows you to color the columns of a column series individually, and to handle this event, you need to opt into it by setting the IsCustomCategoryStyleAllowed property of your ColumnSeries to "true" and then hook the event normally.
From the event arguments of this event, you can get the data item that a particular column represents, and color it according to the service that it represents in your application. The tooltip can also be set here, or on the ColumnSeries by setting the ToolTip property to a ContentControl of your creation.
I have attached a sample project that demonstrates how this can be done. I hope this helps you.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer