Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
920
OlapAxis and Tooltips
posted

 

Hi,

 

In your sample : http://samples.infragistics.com/sldv/RunSamples.aspx?cn=pivot-grid#/pivot-grid/integration-with-datachart

you are creating a datachart with the same datasource as the pivotgrid. My question is how can i add a tooltip?

In the below code, the series are automatically generated. how can i add a tooltip to them?

 

<ig:XamDataChart Grid.Row="1" Grid.Column="0"
            x:Name="xmOlapDataChart"  
            VerticalZoombarVisibility="Visible" 
            VerticalZoomable="True"
            HorizontalZoombarVisibility="Visible"
            HorizontalZoomable="True">
            <ig:XamDataChart.Axes>
                <ig:OlapXAxis 
                    x:Name="olapXAxis"
                    DataSource="{StaticResource DataSource}" 
                    OlapAxisSource="Columns"
                    AutoGenerateSeries="True"   
                    YAxis="{Binding ElementName=xmYAxis1}"/>
                <ig:NumericYAxis x:Name="xmYAxis1" MinimumValue="0" />
            </ig:XamDataChart.Axes>
        </ig:XamDataChart>


also, in my sample i did this on stackedcolumncharts. so it became like this:
<ig:XamDataChart Grid.Row="1" Grid.Column="0"
            x:Name="xmOlapDataChart"  
            VerticalZoombarVisibility="Visible" 
            VerticalZoomable="True"
            HorizontalZoombarVisibility="Visible"
            HorizontalZoomable="True">
            <ig:XamDataChart.Axes>
                <ig:OlapXAxis 
                    x:Name="olapXAxis"
                   DataSource="{StaticResource DataSource}" 
                   SeriesInitialing="olapXAxis_SeriesInitialing" SeriesCreating="olapXAxis_SeriesCreating"
                    OlapAxisSource="Columns"
                    AutoGenerateSeries="True"  
                    Label="{}{Date}"
                    YAxis="{Binding ElementName=xmYAxis1}"/>
                <ig:NumericYAxis x:Name="xmYAxis1" MinimumValue="0" />
            </ig:XamDataChart.Axes>
        </ig:XamDataChart>

and the functions for creating the stacked series are below:

 StackedColumnSeries series;
        private void olapXAxis_SeriesCreating(object sender, SeriesCreatingEventArgs e)
        {
            e.UserCreate = true;
            // creating the stacked fragments
            StackedFragmentSeries stackedFragment = new StackedFragmentSeries();
            stackedFragment.ValueMemberPath = e.SeriesInfo.Title;
        //     creating the tooltip
            TextBlock tooltipbrand = new TextBlock();
            tooltipbrand.Text = e.SeriesInfo.Title + ": ";
TextBlock tooltiptb = new TextBlock(); tooltiptb.SetBinding(TextBlock.TextProperty, new Binding(???????); StackPanel tooltipsp = new StackPanel(); tooltipsp.Children.Add(tooltipbrand); tooltipsp.Children.Add(tooltiptb);
            // adding the tooltip to the stacked fragment
            stackedFragment.ToolTip = tooltipsp;


            // adding stacked fragment to the stacked column series
            series.Series.Add(stackedFragment);
            // adding the stacked column series to the data chart
            e.Series = series;
        }

        private void olapXAxis_SeriesInitialing(object sender, SeriesInitialingEventArgs e)
        {
            series = new StackedColumnSeries();
        }

 

 

so here i am adding a custom tooltip to my stacked fragment but i dont know how to bind the value for the second text block. before the olap axis (when i used category axis) -- i used to say:

 tooltiptb.SetBinding(TextBlock.TextProperty, new Binding("Item.value"));

now it doesn't work. can you please help?

Thanks,
Nazha