Jump to content
Software FX Community

wekelly

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by wekelly

  1. I could not get my chart to print. I narrowed it down to the Chart.UseEffects property. In the following, when UseEffects is false, the chart does not print. When UseEffects is true, the chart prints.

    using System;

    using System.Windows;

    using System.Windows.Controls;

    using System.Windows.Input;

    using ChartFX.WPF;

    class Program

    {

      [sTAThread]

      static void Main(string[] args)

      {

      bool isPrintSuccessful = false;

      Window w = new Window();

      Chart c = new Chart() { UseEffects = isPrintSuccessful };

      w.Content = c;

      // ctrl-p to print

      w.CommandBindings.Add(new CommandBinding(ApplicationCommands.Print, OnPrint));

      new Application().Run(w);

      }

      static void OnPrint(object sender, EventArgs e)

      {

      PrintDialog dlg = new PrintDialog();

      if (dlg.ShowDialog().Value)

      dlg.PrintVisual(sender as Window, "My Chart");

      }

    }

  2. Figured it out. Here is what I was missing:

    1. SeriesAttributes has both a BindingPath and BindingPathX.

    2. I had Visibility.Collapsed my markers for my Line plot. When I switched my chart from a Line plot to a Scatter plot, nothing was displaying because my markers were still Visibility.Collapsed.

  3. I found examples that showed using chart1.Data[0,0] = 3.14 as a way to populate data for an XY scatter plot. But this requires adding data points one at a time.

    Is there a way to populate a scatter chart using SeriesAttributes.ItemSource?

    My thoughts were perhaps binding to List<double[]> where double[0] is the X value and double[1] is the Y value.

    I also considered binding to List<MyValues> where MyValues has properties X and Y.

    I cannot seem to find the right way to do this. Any suggestions?

×
×
  • Create New...