Column Chart


Two examples here, vertical columns (with two data series) and horizontal series (with one data series), the latter is the more recent and shows use of Data Binding.  Note that as of 2016 Syncfusion seem to be offering this functionality through two distinct dlls and it is not at all clear from their public documentation whether one succeeds the other - the coding interface is different and all I can say is that as of September 2016 the code below works as advertised.

Column Chart (Vertical Columns)


Display a Column Chart showing two sets of data values side-by-side



XAML


xaml←ColumnChartXAML
⍝ XAML for the ColumnChart example
 xaml←⊂'<Window'
 xaml,←⊂'    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"'
 xaml,←⊂'    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"'
 xaml,←⊂'    xmlns:sfchart="clr-namespace:Syncfusion.Windows.Chart;assembly=SyncFusion.Chart.WPF"'
 xaml,←⊂'    SizeToContent="WidthandHeight" >'
 xaml,←⊂'    <StackPanel>'
 xaml,←⊂'        <sfchart:Chart Name="wcolumn" Height="200" Width="300">'
 xaml,←⊂'           <sfchart:Chart.Legends>'
 xaml,←⊂'               <sfchart:ChartLegend sfchart:ChartDockPanel.Dock="Right"/>'
 xaml,←⊂'           </sfchart:Chart.Legends>'
 xaml,←⊂'          <sfchart:ChartArea>'
 xaml,←⊂'            <sfchart:ChartSeries Name="wseriesA" Type="Column"/>'
 xaml,←⊂'            <sfchart:ChartSeries Name="wseriesB" Type="Column"/>'
 xaml,←⊂'          </sfchart:ChartArea>'
 xaml,←⊂'        </sfchart:Chart>'
 xaml,←⊂'    </StackPanel>'
 xaml,←⊂'</Window>'


Code


∇  z←ColumnChart(header valuesets);⎕IO;⎕ML;xaml;⎕USING;set;chartdata;point;values;label;series
⍝ Simple ColumnChart example
 ⎕IO ⎕ML←0 3
 xaml←ColumnChartXAML
 #.window←#.UTIL.WPF.LoadXaml xaml(⊂'SyncChart')
 window_column window_seriesA window_seriesB←{#.window.FindName⊂⍵}¨'wcolumn' 'wseriesA' 'wseriesB'
 ⎕USING←,⊂'Syncfusion.Windows.Chart,Syncfusion/4.5/Syncfusion.Chart.WPF.dll'
 window_column.Header←header
 :For set series :InEach valuesets'AB'
     label values←set
     chartdata←⎕NEW ChartListData
     :For point :In values
         chartdata.Add ⎕NEW ChartPoint point
     :EndFor
     ⍎'window_series',series,'.Data←chartdata   '
     ⍎'window_series',series,'.Label←''',label,''''
 :EndFor
 {}#.window.ShowDialog


The 'SyncChart' argument to #.UTIL.LoadXAML has the effect of adding
  'Syncfusion.Windows.Chart,Syncfusion/4.5/Syncfusion.Chart.WPF.dll'
 to the ⎕USING list of LoadXAML

Hardwiring the number of series into the XAML is not the best idea in terms of ultimate flexibility, probably better in practice to skip the XAML and go for direct object creation/manipulation.

Operation


   apples←(⊂'apples'),⊂((⍳5),¨5+?1+⍳5)
   bananas←(⊂'bananas'),⊂((⍳5),¨10+?1+⍳5)
   #.ColumnChart.ColumnChart (⊂ 'Apples versus Bananas'),⊂apples bananas

Bar Chart (Horizontal Columns)

Display a Bar Chart of a single data set



XAML


  ∇ xaml←BarChartXAML
⍝ XAML for the BarChart example
 xaml←⊂'<Window'
 xaml,←⊂'    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"'
 xaml,←⊂'    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"'
 xaml,←⊂'    xmlns:sfchart="clr-namespace:Syncfusion.Windows.Chart;assembly=SyncFusion.Chart.WPF"'
 xaml,←⊂'    SizeToContent="WidthandHeight" >'
 xaml,←⊂'    <StackPanel>'
 xaml,←⊂'        <sfchart:Chart Name="wchart" Height="200" Width="300">'
 xaml,←⊂'          <sfchart:ChartArea>'
 xaml,←⊂'            <sfchart:ChartSeries Name="wseries" Type="Bar" DataSource="{Binding}" BindingPathX="Desc" BindingPathsY="Value"  />'
 xaml,←⊂'          </sfchart:ChartArea>'
 xaml,←⊂'        </sfchart:Chart>'
 xaml,←⊂'    </StackPanel>'
 xaml,←⊂'</Window>'

Code


  ∇ z←BarChart(header values);⎕IO;⎕ML;xaml;⎕USING;window;window_chart;window_series;dt
⍝ Simple ColumnChart example
 ⎕IO ⎕ML←0 3
 xaml←BarChartXAML
 window←#.UTIL.WPF.LoadXaml xaml(⊂'SyncChart')
 window_chart window_series←{window.FindName⊂⍵}¨'wchart' 'wseries'
 window_chart.Header←header
 ⎕USING←'System' 'System.Data,system.data.dll' 'System.Collections'
 dt←⎕NEW DataTable
 {}'Desc' 'Value'{dt.Columns.Add ⍺ ⍵}¨String Int32
 2010⌶dt values
 window_series.DataSource←dt
 {}window.ShowDialog


The 'SyncChart' argument to #.UTIL.LoadXAML has the effect of adding
  'Syncfusion.Windows.Chart,Syncfusion/4.5/Syncfusion.Chart.WPF.dll'
 to the ⎕USING list of LoadXAML

As with the Column Chart example, there's a less-than-optimal spread between the XAML-generation and executional functions - this stems from our author's impatience with Syncfusion (lack of) documentation and a desire to apply what's here in a live situation.

Operation

#.BarChartB.BarData←3 2⍴'this' 1 'that' 4 'the other' 3
#.BarChartB.(BarChart 'BarChart Example' BarData)  


Unresolved Issues