public void NewSet(object sender, NewSetEventArgs e)
        {
            try
            {
                cb_objetive.ItemsSource = null;
                Actual_set = null;
                att_obj    = null;

                if (e.NewSet != null)
                {
                    Actual_set = e.NewSet;
                    cb_objetive.DisplayMemberPath = "Name";
                    cb_objetive.ItemsSource       = null;
                    cb_objetive.ItemsSource       = Actual_set.Attributes.Values;

                    if (e.NewSet.Attributes.Values.Count > 0)
                    {
                        cb_objetive.SelectedIndex = cb_objetive.Items.Count - 1;
                    }
                }
            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
            }
        }
        private void cb_objetiveX_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                att_x = (ClusterEnsemble.Attribute)cb_objetiveX.SelectedItem;

                if (att_x == null || att_y == null)
                {
                    return;
                }
                else
                {
                    rc_graphic.DefaultView.ChartArea.AxisX.Title = att_x.Name;

                    if (Struct != null)
                    {
                        rc_graphic.ItemsSource = null;
                        rc_graphic.ItemsSource = TelerikUtils.FillBubbleChartData(Struct, att_x, att_y);
                    }
                }
            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
            }
        }
        public static List <DataPoint> FillChartData(ClusterEnsemble.Attribute att_objetive)
        {
            List <DataPoint> result = null;

            switch (att_objetive.AttributeType)
            {
            case AttributeType.Nominal:
                result = FillChartStringData(att_objetive);
                break;

            case AttributeType.Numeric:
                result = FillChartNumericData(att_objetive);
                break;

            case AttributeType.String:
                result = FillChartStringData(att_objetive);
                break;

            case AttributeType.Date:
                result = FillChartDateData(att_objetive);
                break;

            default:
                break;
            }

            return(result);
        }
        static List <DataPoint> FillChartDateData(ClusterEnsemble.Attribute att_objetive)
        {
            List <DataPoint> data = new List <DataPoint>();
            Dictionary <DateTime, double> temp_dic = new Dictionary <DateTime, double>();


            foreach (var item in Enviroment.Set.Elements)
            {
                if (item[att_objetive] != null)//missing vallues
                {
                    if (!temp_dic.ContainsKey((DateTime)item[att_objetive]))
                    {
                        temp_dic.Add((DateTime)item[att_objetive], 1);
                    }
                    else
                    {
                        temp_dic[(DateTime)item[att_objetive]]++;
                    }
                }
            }

            foreach (var item in temp_dic.Keys)
            {
                data.Add(new DataPoint()
                {
                    XCategory = item.ToString(), YValue = temp_dic[item], Label = item.ToString(), IsDateTime = true
                });
            }

            data.Sort(new DataPointCategoryComparer());

            return(data);
        }
        public static SeriesMapping InitChart2D(ClusterEnsemble.Attribute att_objetive, RadChart rc_graphic)
        {
            SeriesMapping sm1 = new SeriesMapping();

            sm1.SeriesDefinition = new BarSeriesDefinition();
            sm1.LegendLabel      = "Set Values";

            return(InitChartData(att_objetive, sm1, rc_graphic));
        }
        public static SeriesMapping InitChart(ClusterEnsemble.Attribute att_objetive, RadChart rc_graphic, CheckBox dim)
        {
            bool isChecked = (bool)dim.IsChecked;

            if (isChecked)
            {
                return(InitChart3D(att_objetive, rc_graphic));
            }
            else
            {
                return(InitChart2D(att_objetive, rc_graphic));
            }
        }
 private void cb_Objetive_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         if (cb_objetive.SelectedIndex != -1)
         {
             att_obj = (ClusterEnsemble.Attribute)cb_objetive.SelectedItem;
         }
     }
     catch (Exception _ex)
     {
         GeneralTools.Tools.WriteToLog(_ex);
     }
 }
 private void cb_Objetive_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         if (cb_objetive.SelectedIndex != -1)
         {
             Att_objetive = (ClusterEnsemble.Attribute)cb_objetive.SelectedItem;
         }
     }
     catch (Exception _ex)
     {
         GeneralTools.Tools.WriteToLog(_ex);
     }
 }
        public static List <SeriesMapping> InitBubbleChart(Structuring s, ClusterEnsemble.Attribute att_x, ClusterEnsemble.Attribute att_y)
        {
            List <SeriesMapping> result = new List <SeriesMapping>();

            int i = 0;

            foreach (Cluster item in s.Clusters.Values)
            {
                SeriesMapping sm = new SeriesMapping();
                sm.SeriesDefinition = new BubbleSeriesDefinition();
                sm.LegendLabel      = item.Name;
                sm.CollectionIndex  = i;
                i++;

                ItemMapping bubblesize = new ItemMapping("BubbleSize", DataPointMember.BubbleSize);
                ItemMapping imXCat     = new ItemMapping("XCategory", DataPointMember.XCategory);
                ItemMapping imX        = new ItemMapping("XValue", DataPointMember.XValue);
                ItemMapping imY        = new ItemMapping("YValue", DataPointMember.YValue);
                sm.ItemMappings.Add(bubblesize);
                sm.ItemMappings.Add(imXCat);
                sm.ItemMappings.Add(imX);
                sm.ItemMappings.Add(imY);

                result.Add(sm);
            }

            if (s.HaveUnassignedElements())
            {
                SeriesMapping sm = new SeriesMapping();
                sm.SeriesDefinition = new BubbleSeriesDefinition();
                sm.LegendLabel      = "Unassigned Elements";
                sm.CollectionIndex  = i;
                i++;

                ItemMapping bubblesize = new ItemMapping("BubbleSize", DataPointMember.BubbleSize);
                ItemMapping imXCat     = new ItemMapping("XCategory", DataPointMember.XCategory);
                ItemMapping imX        = new ItemMapping("XValue", DataPointMember.XValue);
                ItemMapping imY        = new ItemMapping("YValue", DataPointMember.YValue);
                sm.ItemMappings.Add(bubblesize);
                sm.ItemMappings.Add(imXCat);
                sm.ItemMappings.Add(imX);
                sm.ItemMappings.Add(imY);

                result.Add(sm);
            }

            return(result);
        }
        static List <DataPoint> FillChartNumericData(ClusterEnsemble.Attribute att_objetive)
        {
            List <DataPoint>            data     = new List <DataPoint>();
            Dictionary <double, double> temp_dic = new Dictionary <double, double>();

            double max = double.MinValue;
            double min = double.MaxValue;

            foreach (var item in Enviroment.Set.Elements)
            {
                if (item[att_objetive] != null)//missing values
                {
                    if (!temp_dic.ContainsKey((double)item[att_objetive]))
                    {
                        temp_dic.Add((double)item[att_objetive], 1);
                        if ((double)item[att_objetive] > max)
                        {
                            max = (double)item[att_objetive];
                        }
                        else if ((double)item[att_objetive] < min)
                        {
                            min = (double)item[att_objetive];
                        }
                    }
                    else
                    {
                        temp_dic[(double)item[att_objetive]]++;
                    }
                }
            }


            foreach (var item in temp_dic.Keys)
            {
                data.Add(new DataPoint()
                {
                    Label = item.ToString(), YValue = temp_dic[item]
                });
            }


            data.Sort(new DataPointXComparer());

            return(data);
        }
        public static List <List <DataPoint> > FillBubbleChartData(Structuring s, ClusterEnsemble.Attribute att_x, ClusterEnsemble.Attribute att_y)
        {
            List <List <DataPoint> > result = new List <List <DataPoint> >();

            foreach (Cluster item in s.Clusters.Values)
            {
                List <DataPoint> temp = FillOneClusterData(item, att_x, att_y);
                result.Add(temp);
            }
            if (s.HaveUnassignedElements())
            {
                List <DataPoint> temp = FillUnassignedData(s.UnassignedElements, att_x, att_y);
                result.Add(temp);
            }

            ResetCategory();
            return(result);
        }
        public void NewSet(object sender, NewSetEventArgs e)
        {
            try
            {
                tb_alg_name.Text = "";

                Struct = null;
                rc_graphic.SeriesMappings.Reset();
                rc_graphic.ItemsSource = null;

                cb_objetiveX.ItemsSource = null;
                cb_objetiveY.ItemsSource = null;

                if (e.NewSet != null)
                {
                    cb_objetiveX.ItemsSource = e.NewSet.Attributes.Values;
                    cb_objetiveX.DisplayMemberPath = "Name";
                    cb_objetiveY.ItemsSource = e.NewSet.Attributes.Values;
                    cb_objetiveY.DisplayMemberPath = "Name";

                    if (e.NewSet.Attributes.Values.Count > 0)
                    {
                        cb_objetiveX.SelectedIndex = 0;
                        att_x = (ClusterEnsemble.Attribute)cb_objetiveX.SelectedItem;
                        cb_objetiveY.SelectedIndex = 0;
                        att_y = (ClusterEnsemble.Attribute)cb_objetiveY.SelectedItem;
                    }
                    if (att_x != null && att_y != null)
                    {
                        rc_graphic.DefaultView.ChartArea.AxisX.Title = att_x.Name;
                        rc_graphic.DefaultView.ChartArea.AxisY.Title = att_y.Name;
                    }
                    TelerikUtils.SetAnimationsSettings(rc_graphic);
                }

            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
            }
        }
        public void NewSet(object sender, NewSetEventArgs e)
        {
            try
            {
                tb_alg_name.Text = "";

                Struct = null;
                rc_graphic.SeriesMappings.Reset();
                rc_graphic.ItemsSource = null;

                cb_objetiveX.ItemsSource = null;
                cb_objetiveY.ItemsSource = null;

                if (e.NewSet != null)
                {
                    cb_objetiveX.ItemsSource       = e.NewSet.Attributes.Values;
                    cb_objetiveX.DisplayMemberPath = "Name";
                    cb_objetiveY.ItemsSource       = e.NewSet.Attributes.Values;
                    cb_objetiveY.DisplayMemberPath = "Name";

                    if (e.NewSet.Attributes.Values.Count > 0)
                    {
                        cb_objetiveX.SelectedIndex = 0;
                        att_x = (ClusterEnsemble.Attribute)cb_objetiveX.SelectedItem;
                        cb_objetiveY.SelectedIndex = 0;
                        att_y = (ClusterEnsemble.Attribute)cb_objetiveY.SelectedItem;
                    }
                    if (att_x != null && att_y != null)
                    {
                        rc_graphic.DefaultView.ChartArea.AxisX.Title = att_x.Name;
                        rc_graphic.DefaultView.ChartArea.AxisY.Title = att_y.Name;
                    }
                    TelerikUtils.SetAnimationsSettings(rc_graphic);
                }
            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
            }
        }
        public static SeriesMapping InitChartData(ClusterEnsemble.Attribute att_objetive, SeriesMapping sm1, RadChart rc_graphic)
        {
            SeriesMapping result = null;

            switch (att_objetive.AttributeType)
            {
            case AttributeType.String:
            case AttributeType.Nominal:
            case AttributeType.Date:
                rc_graphic.DefaultView.ChartArea.AxisX.LabelRotationAngle = 45;
                result = InitChartDataString(sm1);
                break;

            case AttributeType.Numeric:
                rc_graphic.DefaultView.ChartArea.AxisX.LabelRotationAngle = 0;
                result = InitChartDataNumeric(sm1);
                break;

            default:
                break;
            }
            return(result);
        }
예제 #15
0
        private void RadComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                if (Cb_objetive.SelectedIndex != -1)
                {
                    att_objetive = (ClusterEnsemble.Attribute)Cb_objetive.SelectedItem;
                    Rc_att.DefaultView.ChartArea.AxisX.Title = att_objetive.Name;
                    SeriesMapping _series = TelerikUtils.InitChart(att_objetive, Rc_att, DCheckBox);
                    Rc_att.SeriesMappings.Clear();
                    Rc_att.SeriesMappings.Add(_series);
                    List <DataPoint> _temp = TelerikUtils.FillChartData(att_objetive);

                    if ((bool)DCheckBox.IsChecked)
                    {
                        TelerikUtils.ChartAreaZoom(Rc_att);
                    }

                    Rc_att.ItemsSource = null;

                    //if (IContainerProgressBar != null)
                    //{
                    //    IContainerProgressBar.ResetProgressBar(1, 1, true);
                    //    IContainerProgressBar.UpdateProgressBar(1, "Loading Data Series...", true);
                    //}

                    Rc_att.ItemsSource = _temp;

                    //if (IContainerProgressBar != null)
                    //    IContainerProgressBar.FinishPB();
                }
            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
            }
        }
예제 #16
0
        private void lv_attributes_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                //No puedo preguntar por el SelectedIndex porque cuando mando a seleccionar todos el selected index == -1
                //y entonces no me entra en el IF y no se actualiza AttributesToCalculateProximity en la clase Environment
                //if (this.lv_attributes.SelectedIndex != -1)
                //{
                if (CheckAttributeEventHandler != null)
                {
                    CheckAttributeEventHandler(this, new CheckAttributeEnventArgs(GetSelectedAttributes()));
                }
                //}

                //Esto es para actualizar el texto, de name, missing,distinct, unique
                if (this.lv_attributes.SelectedItem != null)
                {
                    ClusterEnsemble.Attribute _attr = (this.lv_attributes.SelectedItem as AttributeInfo).Attribute;

                    this.tblk_SelectedAttrName.Text     = _attr.Name;
                    this.tblk_SelectedAttrDistinct.Text = _attr.Distinct.ToString();
                    this.tblk_SelectedAttrMissing.Text  = _attr.Missing.ToString() + "(" + _attr.MissingPercent + "%)";
                    this.tblk_SelectedAttrUnique.Text   = _attr.Unique.ToString() + "(" + _attr.UniquePercent + "%)";
                }
                else
                {
                    this.tblk_SelectedAttrName.Text     = "---";
                    this.tblk_SelectedAttrUnique.Text   = "---";
                    this.tblk_SelectedAttrMissing.Text  = "---";
                    this.tblk_SelectedAttrDistinct.Text = "---";
                }
            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
            }
        }
        private void cb_objetiveX_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                att_x = (ClusterEnsemble.Attribute)cb_objetiveX.SelectedItem;

                if (att_x == null || att_y == null)
                    return;
                else
                {
                    rc_graphic.DefaultView.ChartArea.AxisX.Title = att_x.Name;

                    if (Struct != null)
                    {
                        rc_graphic.ItemsSource = null;
                        rc_graphic.ItemsSource = TelerikUtils.FillBubbleChartData(Struct, att_x, att_y);
                    }
                }
            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
            }
        }
        static List <DataPoint> FillOneClusterData(Cluster cluster, ClusterEnsemble.Attribute att_x, ClusterEnsemble.Attribute att_y)
        {
            List <DataPoint> result = new List <DataPoint>();

            foreach (Element item in cluster.Elements)
            {
                DataPoint dp = new DataPoint();
                if (item[att_x] != null && item[att_y] != null)//missing values
                {
                    if (att_x.AttributeType == AttributeType.Numeric)
                    {
                        dp.XValue = (double)item[att_x] + 10;//valores cercanos a cero se funde el control
                    }
                    else if (att_x.AttributeType != AttributeType.Date)
                    {
                        if (xcat.ContainsKey((string)item[att_x]))
                        {
                            dp.XValue = xcat[(string)item[att_x]];
                        }
                        else
                        {
                            xcat.Add((string)item[att_x], ix);
                            dp.XValue = ix;
                            ix++;
                        }
                    }
                    else
                    {
                        if (xcat.ContainsKey(((DateTime)item[att_x]).ToString()))
                        {
                            dp.XValue = xcat[(string)item[att_x]];
                        }
                        else
                        {
                            xcat.Add(((DateTime)item[att_x]).ToString(), ix);
                            dp.XValue = ix;
                            ix++;
                        }
                    }

                    if (att_y.AttributeType == AttributeType.Numeric)
                    {
                        dp.YValue = (double)item[att_y] + 10;//valores cercanos a cero se funde el control
                    }
                    else if (att_y.AttributeType != AttributeType.Date)
                    {
                        if (ycat.ContainsKey((string)item[att_y]))
                        {
                            dp.YValue = ycat[(string)item[att_y]];
                        }
                        else
                        {
                            ycat.Add((string)item[att_y], iy);
                            dp.YValue = iy;
                            iy++;
                        }
                    }
                    else
                    {
                        if (ycat.ContainsKey(((DateTime)item[att_y]).ToString()))
                        {
                            dp.YValue = ycat[(string)item[att_y]];
                        }
                        else
                        {
                            ycat.Add(((DateTime)item[att_y]).ToString(), iy);
                            dp.YValue = iy;
                            iy++;
                        }
                    }

                    //dp.BubbleSize = 20;
                    result.Add(dp);
                }
            }

            result.Sort(new DataPointXComparer());

            return(result);
        }
        private void RadComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                if (Cb_objetive.SelectedIndex != -1)
                {
                    att_objetive = (ClusterEnsemble.Attribute)Cb_objetive.SelectedItem;
                    Rc_att.DefaultView.ChartArea.AxisX.Title = att_objetive.Name;
                    SeriesMapping _series = TelerikUtils.InitChart(att_objetive, Rc_att, DCheckBox);
                    Rc_att.SeriesMappings.Clear();
                    Rc_att.SeriesMappings.Add(_series);
                    List<DataPoint> _temp = TelerikUtils.FillChartData(att_objetive);

                    if ((bool)DCheckBox.IsChecked)
                        TelerikUtils.ChartAreaZoom(Rc_att);

                    Rc_att.ItemsSource = null;

                    //if (IContainerProgressBar != null)
                    //{
                    //    IContainerProgressBar.ResetProgressBar(1, 1, true);
                    //    IContainerProgressBar.UpdateProgressBar(1, "Loading Data Series...", true);
                    //}

                    Rc_att.ItemsSource = _temp;

                    //if (IContainerProgressBar != null)
                    //    IContainerProgressBar.FinishPB();


                }
            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
            }
        }
        public void NewSet(object sender, NewSetEventArgs e)
        {
            try
            {
                cb_objetive.ItemsSource = null;
                Actual_set = null;
                att_obj = null;

                if (e.NewSet != null)
                {
                    Actual_set = e.NewSet;
                    cb_objetive.DisplayMemberPath = "Name";
                    cb_objetive.ItemsSource = null;
                    cb_objetive.ItemsSource = Actual_set.Attributes.Values;

                    if (e.NewSet.Attributes.Values.Count > 0)
                        cb_objetive.SelectedIndex = cb_objetive.Items.Count - 1;
                }
            }
            catch (Exception _ex)
            {
                GeneralTools.Tools.WriteToLog(_ex);
            }
        }