}// createShowPlot
 private Tuple<PlotModel, PlotModel> createKMeansPlots()
 {
     PlotModel histog = null;
     PlotModel show = null;
     try
     {
         var oSet = this.KMeansClusterSet;
         if (oSet == null)
         {
             return new Tuple<PlotModel, PlotModel>(null, null);
         }
         var clusters = oSet.Clusters;
         Collection<HistogItem> items = new Collection<HistogItem>();
         foreach (var oCluster in clusters)
         {
             HistogItem item = new HistogItem();
             String label = oCluster.Name;
             item.Value1 = oCluster.Count;
             items.Add(item);
         }// oCluster
         var model = new PlotModel("Effectif des clusters")
         {
             LegendPlacement = LegendPlacement.Outside,
             LegendPosition = LegendPosition.RightTop,
             LegendOrientation = LegendOrientation.Vertical
         };
         // Add the axes, note that MinimumPadding and AbsoluteMinimum should be set on the value axis.
         model.Axes.Add(new CategoryAxis { ItemsSource = items, LabelField = "Label" });
         model.Axes.Add(new LinearAxis(AxisPosition.Left) { MinimumPadding = 0, AbsoluteMinimum = 0 });
         model.Series.Add(new ColumnSeries { Title = DEFAULT_SERIE_NAME, ItemsSource = items, ValueField = "Value1" });
         histog = model;
         //
         var pMan = this.DataService;
         VariableDesc oVarY = this.CurrentYVariable;
         VariableDesc oVarX = this.CurrentXVariable;
         if ((pMan == null) || (oVarX == null) || (oVarY == null))
         {
             return new Tuple<PlotModel, PlotModel>(histog, show);
         }
         if (oVarX == oVarY)
         {
             return new Tuple<PlotModel, PlotModel>(histog, show);
         }
         if ((!oVarX.IsNumVar) || (!oVarX.IsValid) || (!oVarY.IsNumVar) || (!oVarY.IsValid))
         {
             return new Tuple<PlotModel, PlotModel>(histog, show);
         }
         var dataX = ComputeVariableCategValues(this.CurrentCategVariable, oVarX);
         var dataY = ComputeVariableCategValues(this.CurrentCategVariable, oVarY);
         var keys = dataX.Keys;
         String sTitle = String.Format("{0} / {1}", oVarY.Name, oVarX.Name);
         model = new PlotModel(sTitle) { LegendPlacement = LegendPlacement.Outside };
         foreach (var cluster in clusters)
         {
             var s1 = new ScatterSeries(cluster.Name);
             foreach (var ind in cluster.Elements)
             {
                 var col = ind.Values;
                 var qx = from x in col where x.VariableId == oVarX.Id select x;
                 var qy = from x in col where x.VariableId == oVarY.Id select x;
                 if ((qx.Count() > 0) && (qy.Count() > 0))
                 {
                     var vx = qx.First();
                     var vy = qy.First();
                     double xx = vx.DoubleValue;
                     double yy = vy.DoubleValue;
                     s1.Points.Add(new ScatterPoint(xx, yy) { Tag = ind });
                 }
             }// ind
             model.Series.Add(s1);
         }// cluster
         show = model;
     }
     catch (Exception /* ex */)
     {
     }
     return new Tuple<PlotModel, PlotModel>(histog, show);
 }// createKMeansPLots
 public PlotModel createHistogPlotModel(IEnumerable<double> data, String varname)
 {
     if (data == null)
     {
         return null;
     }
     double[] oAr = data.ToArray();
     int n = oAr.Length;
     if (n < 2)
     {
         return null;
     }
     ColumnSeries s2 = new ColumnSeries();
     DescriptiveStatistics st = new DescriptiveStatistics(oAr);
     double mean = st.Mean;
     double dev = st.StandardDeviation;
     if (dev <= 0.0)
     {
         return null;
     }
     var histog = new Histogram(oAr, 11);
     int nc = histog.BucketCount;
     Normal dist = new Normal();
     Collection<HistogItem> items = new Collection<HistogItem>();
     for (int i = 0; i < nc; ++i)
     {
         HistogItem item = new HistogItem();
         var b = histog[i];
         double x = (b.LowerBound + b.UpperBound) / 2.0;
         String label = String.Format("{0}", myconvert(x));
         int nx = (int)(dist.Density((x - mean) / dev) * n);
         item.Label = label;
         item.Value1 = b.Count;
         item.Value2 = nx;
         items.Add(item);
     }// i
     var model = new PlotModel(varname)
     {
         LegendPlacement = LegendPlacement.Outside,
         LegendPosition = LegendPosition.RightTop,
         LegendOrientation = LegendOrientation.Vertical
     };
     // Add the axes, note that MinimumPadding and AbsoluteMinimum should be set on the value axis.
     model.Axes.Add(new CategoryAxis { ItemsSource = items, LabelField = "Label" });
     model.Axes.Add(new LinearAxis(AxisPosition.Left) { MinimumPadding = 0, AbsoluteMinimum = 0 });
     model.Series.Add(new ColumnSeries { Title = varname, ItemsSource = items, ValueField = "Value1" });
     model.Series.Add(new ColumnSeries { Title = "DistributionNormale", ItemsSource = items, ValueField = "Value2" });
     return model;
 }