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
199
Fill a chart without an animation
posted

Hello !

Someone can advise me to tell me how i can fill a ScatterLineChart without animation ? I don't find how to do !

All the examples are with animation, and i don't need animation my goal is to print the chart.

Other question, in wich control should i put my chart to print it correctly ? Page ? Canvas ? 

Thank you so much to ask me.  

Stéphanie 

(sorry for my poor english, i'm just a swiss :-) ) 

Parents
  • 739
    posted

    Hello Stéphanie,

    Thank you for using Infragistics WPF Chart. This is the sample which shows how to use Scatter line chart without animation:

     <igCA:XamChart Name="ScatterLineChart3D" View3D="False"  >
          <!-- Series -->
          <igCA:XamChart.Series>
            <igCA:Series Stroke="Black" ChartType="ScatterLine">
              <igCA:Series.DataPoints>
                <igCA:DataPoint>
                  <igCA:DataPoint.ChartParameters>
                    <igCA:ChartParameter Type="ValueX" Value="2/5/63"/>
                    <igCA:ChartParameter Type="ValueY" Value="8"/>
                   </igCA:DataPoint.ChartParameters>
                </igCA:DataPoint>
                <igCA:DataPoint>
                  <igCA:DataPoint.ChartParameters>
                    <igCA:ChartParameter Type="ValueX" Value="2/6/63"/>
                    <igCA:ChartParameter Type="ValueY" Value="3"/>
                    <igCA:ChartParameter Type="ValueZ" Value="10"/>
                  </igCA:DataPoint.ChartParameters>
                </igCA:DataPoint>
                <igCA:DataPoint>
                  <igCA:DataPoint.ChartParameters>
                    <igCA:ChartParameter Type="ValueX" Value="2/7/63"/>
                    <igCA:ChartParameter Type="ValueY" Value="9"/>
                   </igCA:DataPoint.ChartParameters>
                </igCA:DataPoint>
                <igCA:DataPoint>
                  <igCA:DataPoint.ChartParameters>
                    <igCA:ChartParameter Type="ValueX" Value="2/10/63"/>
                    <igCA:ChartParameter Type="ValueY" Value="6"/>
                   </igCA:DataPoint.ChartParameters>
                </igCA:DataPoint>
                <igCA:DataPoint>
                  <igCA:DataPoint.ChartParameters>
                    <igCA:ChartParameter Type="ValueX" Value="2/11/63"/>
                    <igCA:ChartParameter Type="ValueY" Value="7"/>
                  </igCA:DataPoint.ChartParameters>
                </igCA:DataPoint>
                <igCA:DataPoint>
                  <igCA:DataPoint.ChartParameters>
                    <igCA:ChartParameter Type="ValueX" Value="2/11/63"/>
                    <igCA:ChartParameter Type="ValueY" Value="3"/>
                   </igCA:DataPoint.ChartParameters>
                </igCA:DataPoint>
              </igCA:Series.DataPoints>
             
            </igCA:Series>
          </igCA:XamChart.Series>
        </igCA:XamChart>

    If you want to use printing there are to ways: Normal printing and Hi-res printing. Before we use printing lets first create a chart in xaml:

    <igCA:XamChart Name="chart3d" Width="400" Height="400" View3D="True">

    <igCA:XamChart.Series>

    <igCA:Series ChartType="Pie">

    <igCA:Series.DataPoints>

    <igCA:DataPoint Value="4"/>

    <igCA:DataPoint Value="7"/>

    <igCA:DataPoint Value="8"/>

    <igCA:DataPoint Value="3"/>

    </igCA:Series.DataPoints>

    <igCA:Series.Marker>

    <igCA:Marker Fill="#FFCCC5C5" Foreground="#FFFBFBFB"/>

    </igCA:Series.Marker>

    </igCA:Series>

    </igCA:XamChart.Series>

    <igCA:XamChart.Transform3D>

    <Transform3DGroup>

    <TranslateTransform3D OffsetX="0" OffsetY="0" OffsetZ="0"/>

    <ScaleTransform3D ScaleX="1" ScaleY="1" ScaleZ="1"/>

    <RotateTransform3D >

    <RotateTransform3D.Rotation>

    <AxisAngleRotation3D Angle="27" Axis="-0.879,0.469,-0.082"/>

    </RotateTransform3D.Rotation>

    </RotateTransform3D>

    <TranslateTransform3D OffsetX="0" OffsetY="0" OffsetZ="0"/>

    <TranslateTransform3D OffsetX="0" OffsetY="0" OffsetZ="0"/>

    </Transform3DGroup>

    </igCA:XamChart.Transform3D>

    </igCA:XamChart>

     

    1. For normal printing you need this code:

     

    PrintDialog printDlg = new PrintDialog();

    printDlg.ShowDialog();

    printDlg.PrintVisual(chart3d, "Printing");

     

    2. This is a sample for hi-res printing:

    Rect printRect = new Rect(0, 0, 500, 500);

    int width = (int)(500.0 / 96.0 * printRect.Width);

    int height = (int)(500.0 / 96.0 * printRect.Width);RenderTargetBitmap bitmap = new RenderTargetBitmap(width, height, 500, 500, PixelFormats.Default);

    bitmap.Render(chart3d);

    Image printImage = new Image();

    PrintDialog printDlg = new PrintDialog();

    printDlg.ShowDialog();

    printImage.Measure(
    new Size(printDlg.PrintableAreaWidth, printDlg.PrintableAreaHeight));

    printImage.Source = bitmap;

    printImage.Stretch =
    Stretch.None;

    printImage.Arrange(new Rect(new Point(0, 0), printImage.DesiredSize));

    printDlg.PrintVisual(printImage, "Printing");

    Regards,

    GoranS

Reply Children