/// <summary> /// Changes the PC to used K-Means with the specified column for the clusters /// or uses the regular data /// </summary> /// <param name="columnIndex"></param> private void ChangePC(int columnIndex) { //COLOR according to clusters if (columnIndex != -1) { iPcPlot.SetSelectedHeaderIndexes(new List <int>()); //if previously using normal datacube if (!kMeansClusteringOn) { iPcPlot.ColorMap.Input = kMeansFilter; kMeansClusteringOn = !kMeansClusteringOn; } iPcPlot.ColorMap.Index = columnIndex; kMeansFilter.CommitChanges(); } //CLUSTERING WAS PREVIOUSLY ON else if (kMeansClusteringOn) { iPcPlot.ColorMap.Input = iDataCube; kMeansClusteringOn = !kMeansClusteringOn; //pcPlot.ColorMap.Index = iDataCube.Data.GetLength(0) - 1; iPcPlot.ColorMap.Index = 1; } else { //None to None } iPcPlot.GuideLineEnabled = true; }
/// <summary> /// Initializes the view components: PC plot, its SubComponents and /// its properties /// </summary> private void SetupView() { this.headers.Add("Country"); this.headers.Add("Median Age\n(years)"); this.headers.Add("Albums\n(Log2)"); this.headers.Add("Unemployment Rate\n(%)"); this.headers.Add("GDP Per Capita\n($)"); iPcPlot = InitializeParallelCoordinatesPlot(iPanel, iDataCube, -1, headers); // Padding: so the names of the countries don't be cut iPcPlot.PaddingLeft += 60; iPcPlot.PaddingTop += 15; iPcPlot.PickSensitivity = 3; iPcPlot.Picked += new EventHandler <IndexesPickedEventArgs>(pcPlot_Picked); iPcPlot.FilterChanged += new EventHandler(pcPlot_FilterChanged); iPcPlot.LineTransparency = 235; iPcPlot.LineTransparencySelected = 200; iPcPlot.SelectedLineColor = Color.Black; iPcPlot.SelectedLineThickness = 3; iPcPlot.OutfilteredLineColor = Color.LightGray; iPcPlot.ShowOutFilteredLines = true; textLens = new TextLensSubComponent(iPcPlot, iPanel, iDoc); iPcPlot.AddSubComponent(textLens); iPcPlot.HeaderClicked += new EventHandler(PCPlotHeaderClicked); /************************************************************************/ /* XXX: FONTS NOT WORKING */ /************************************************************************/ iPcPlot.FontSelectedHeaders = new Font("Verdana", 14, FontStyle.Bold); iPcPlot.SelectedHeaderTextColor = Color.Red; List <int> list = new List <int>(); list.Add(1); iPcPlot.SetSelectedHeaderIndexes(list); int countriesCount = iCountryNames.Count; // iterate through all the countries and for (int i = 0; i < countriesCount; i++) { float verticalPosition = 1.0f - (float)i / (float)(countriesCount - 1); string country = iCountryNames[i]; textLens.AddLabel(country, verticalPosition, (int)i); } }