Quantcast
Viewing all articles
Browse latest Browse all 18858

How to add a Chart in Flow document.

hi,

i need to add a wpf Chart to a flow document for generating XPS report. but in flow-document we can add only Block type controls like(Table,Paragraph) and the  chart is a visual type object so how can i add  a chart in flow document.

 public static Chart Loadgraph() {
      Chart chart = new Chart();
      LineSeries series = new LineSeries();
      chart.Series.Add(series);
      Binding key = new Binding { Path = new PropertyPath("Key") };
      Binding value = new Binding { Path = new PropertyPath("Value") };
      series.IndependentValueBinding = key;
      series.DependentValueBinding = value;
      ((LineSeries)chart.Series[0]).ItemsSource =
          new[]{
            new KeyValuePair<int, int>(0, 100),
            new KeyValuePair<int, int>(45, 130),
            new KeyValuePair<int, int>(15, 150),
            new KeyValuePair<int, int>(20, 125),
            new KeyValuePair<int, int>(25, 155) };
      return chart;
    }

flowdocument.blocks.add(chart);//iam getting exception



Viewing all articles
Browse latest Browse all 18858

Trending Articles