Hi Team,
I have a column stacked Xam Data Chart as attached in the first image mentioned below .I need a olap axis curve on x axis for the data points plotted on the graph against y axis.Attached an image for the expected output i am trying to get( 2nd image).Tried doing the same but ended up in issues.Can you please provide a sample if you have any .
Thanks in advance for all you do
Note:I have got only one series in my graph
Below mentioned is the sample code that i used
Xaml File:
<Window x:Class="XamDataChartServiceReportsCase.DataTableTest" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ig="http://schemas.infragistics.com/xaml" Title="DataTableTest" Height="Auto" Width="Auto"> <Grid> <Grid.Resources> <ContentControl x:Key="theTooltip"> <StackPanel Orientation="Vertical"> <StackPanel Orientation="Horizontal"> <TextBlock Text="Service: " FontWeight="Bold"/> <TextBlock Text="{Binding Item.Column}"/> </StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock Text="Report: " FontWeight="Bold"/> <TextBlock Text="{Binding Item.Report}"/> </StackPanel> </StackPanel> </ContentControl>
</Grid.Resources> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition Height="40"/> </Grid.RowDefinitions> <ig:XamDataChart x:Name="chart" Title="Report Distribution Graph" DefaultInteraction="None" > <ig:XamDataChart.Axes> <ig:CategoryXAxis x:Name="xAxis" ItemsSource="{Binding DefaultView}" Label="{}{Label}" > <ig:CategoryXAxis.LabelSettings > <ig:AxisLabelSettings Location="InsideLeft" Extent="5" /> </ig:CategoryXAxis.LabelSettings> </ig:CategoryXAxis> <ig:NumericYAxis x:Name="yAxis" MinimumValue="0" MaximumValue="100" MajorStrokeThickness="0" MinorStrokeThickness="0" Title="Reports /Data Density" > <ig:NumericYAxis.TitleSettings > <ig:TitleSettings Position="Auto" Angle="-90" /> </ig:NumericYAxis.TitleSettings> </ig:NumericYAxis> </ig:XamDataChart.Axes> <ig:XamDataChart.Series>
<ig:ColumnSeries XAxis="{Binding ElementName=xAxis}" YAxis="{Binding ElementName=yAxis}" ItemsSource="{Binding DefaultView}" ValueMemberPath="Value" Thickness='0' Outline='Black' ToolTip="{StaticResource theTooltip}" IsCustomCategoryStyleAllowed="True" />
</ig:XamDataChart.Series> </ig:XamDataChart> <!--<Button x:Name="addColumnBtn" Content="Add Column/Series" Click="addColumnBtn_Click" Grid.Row="1"/>-->
</Grid></Window>
Xaml Code Behind File :
using System;using System.Collections.Generic;using System.Data;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Shapes;using Infragistics.Controls.Charts;
namespace XamDataChartServiceReportsCase{ /// <summary> /// Interaction logic for DataTableTest.xaml /// </summary> public partial class DataTableTest : Window { Random r = new Random(); DataTable table = new DataTable();
public DataTableTest() { InitializeComponent();
table.Columns.Add(new DataColumn("Label", typeof (string))); table.Columns.Add(new DataColumn("Value", typeof (int))); table.Columns.Add(new DataColumn("Report", typeof (string))); table.Columns.Add(new DataColumn("Column", typeof (string))); for (int i = 0; i < 10; i++) { DataRow row = table.NewRow();
row["Label"] = "Resistivity Diagnostics 1234 " + Convert.ToString(1);
row["Column"] = "Service " + Convert.ToString(1); row["Report"] = "rEPORT"; row["Value"] = r.Next(1, 100);
table.Rows.Add(row);
} this.DataContext = table; } }
}
Hello Srikanth,
I'm not really sure what an Olap axis curve is. Your second screenshot looks more like a trend line than anything else. The only Olap related feature we have for the xamDataChart is the OlapXAxis (http://help.infragistics.com/doc/WPF/2016.1/CLR4.0/?page=DataChart_Visualizing_Multi-Dimensional_Data_(OLAP_Data)_(xamDataChart).html). It is an axis type that you create and assign OLAP data to and it will show that data in the chart.
Making a line like the screenshot shouldn't be that difficult assuming you already have the data for it. A SplineSeries will give you the same curvy look.
Hi Rob,
Thanks for the quick reply .But can you provide a sample on how to get a spline curve on the column series as mentioned in the image.
Regards,
Srikanth.