Exemplo n.º 1
0
        //show tooltip when hovering over line in Variable plot
        void _hoverController_Hover_Var(object sender, EventArgs e)
        {
            if (!UsingKMeans)
            {
                int x = _hoverControllerVar.HoverScreenPosition.X;
                int y = _hoverControllerVar.HoverScreenPosition.Y;
                System.Drawing.Point mousePos = _hoverControllerVar.HoverPosition;

                //get country id
                int[] countryList = _pcPlotVariables.GetLineIndexesAtPosition(mousePos, 2).ToArray();
                //check if country is hidden
                int country = -1;
                if (countryList.Length > 0)
                {
                    for (int i = 0; i < countryList.Length; i++)
                    {
                        if (_pcPlotVariables.IndexVisibilityManager.GetVisibility(countryList[i]))
                        {
                            country = countryList[i];
                            break;
                        }
                    }
                }
                if (country > -1)
                {
                    //init tooltip
                    String tooltip = _mainWindow.DataHandler.RawDataProvider.NaNColumns[0][0][country].ToString();

                    // where to draw tooltip
                    //System.Drawing.Point atThisLocation = new System.Drawing.Point(_hoverControllerVar.HoverScreenPosition.X - 3, _hoverControllerVar.HoverScreenPosition.Y - 3);

                    //get current year
                    int year = _mainWindow.yearSlider.Value;
                    //loop over info to show in tooltip
                    for (int i = 0; i < _mainWindow.DataHandler.RawDataProvider.ColumnHeaders.Count; i++)
                    {
                        tooltip += "\n" + _mainWindow.DataHandler.RawDataProvider.ColumnHeaders[i];
                        tooltip += "   " + _mainWindow.DataHandler.getValueFromDataCube(i, country, year);
                    }
                    _gavToolTip.Text = tooltip;
                    _gavToolTip.Show(new System.Drawing.Point(x - 5, y - 5));
                }

                //tooltip for header names, funkar inte nu

                /*
                 * int header = _pcPlotVariables.AxisLayer.AxisAtPosition(new System.Drawing.Point(mousePos.X, mousePos.Y + 40), 5);
                 * if (header != -1)
                 * {
                 *  _gavToolTip.Text = _mainWindow.DataHandler.RawDataProvider.ColumnHeaders[header];
                 *  _gavToolTip.Show(new System.Drawing.Point(x,y));
                 * }
                 */
            }
        }
Exemplo n.º 2
0
        public MapPlot(DataCube aDataCube, Panel aDestinationPanel, Renderer aRenderer,
                       ColorMap aColorMap, ParallelCoordinatesPlot aPcPlot, GMSDocument aDoc)
        {
            iDataCube = aDataCube;
            iPanel    = aDestinationPanel;
            renderer  = aRenderer;
            iColorMap = aColorMap;

            iPcPlot         = aPcPlot;
            iDoc            = aDoc;
            iLegendColorMap = iDoc.iFilteredSelectedColorMap;

            SetupMapLayers();

            //Get country names
            iCountryNames = iDoc.GetFilteredCountryNames();

            //Prepare tooltip
            iToolTip            = new GavToolTip(iPanel);
            iToolTip.FadeEnable = true;
            iToolTip.FadeTime   = TOOLTIP_FADE_DELAY;
            iToolTip.Show(new Point(0, 0));
            iToolTip.Hide();

            iMouseHoverControl           = new MouseHoverController(iPanel, TOOLTIP_SENSITIVITY, TIMER_DELAY);
            iMouseHoverControl.Hover    += new EventHandler(iMouseHoverControl_Hover);
            iMouseHoverControl.HoverEnd += new EventHandler(iMouseHoverControl_HoverEnd);

            iDoc.Picked          += new EventHandler <IndexesPickedEventArgs>(DocumentPicked);
            iDoc.ColorMapChanged += new EventHandler <EventArgs>(DocumentColorMapChanged);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Constructor
        /// </summary>
        public TreeMap(System.Windows.Forms.Panel aPanel, GMSDocument aDoc, ParallelCoordinatesPlot aPcPlot)
        {
            iPanel              = aPanel;
            iPanel.SizeChanged += new EventHandler(SizeChanged);
            iPanel.Paint       += new System.Windows.Forms.PaintEventHandler(Paint);
            iToolTip            = new GavToolTip(iPanel);

            iPcPlot = aPcPlot;

            iToolTip.FadeEnable = true;
            iToolTip.FadeTime   = TOOLTIP_FADE_DELAY;
            iToolTip.Show(new Point(0, 0));
            iToolTip.Hide();

            iPanel.MouseLeave           += new EventHandler(MouseHoverControlHoverEnd);
            iMouseHoverControl           = new MouseHoverController(iPanel, 5, TIMER_DELAY);
            iMouseHoverControl.Hover    += new EventHandler(MouseHoverControlHover);
            iMouseHoverControl.HoverEnd += new EventHandler(MouseHoverControlHoverEnd);

            iDoc = aDoc;

            aDoc.ColorMapChanged += new EventHandler <EventArgs>(DocumentColorMapChanged);
            iDoc.Picked          += new EventHandler <IndexesPickedEventArgs>(DocumentPicked);

            iPanel.MouseDown += new MouseEventHandler(MouseDown);
            iSelectedIds      = new List <int>();


            iZoomIn = false;

            UpdateDrawingArea();
        }
Exemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void MouseHoverControlHover(object sender, EventArgs e)
        {
            object label = OnHoverRectangle(iMouseHoverControl.HoverPosition);

            iToolTip.Text = (string)label;

            iToolTip.Hide();
            iToolTip.Show(iPanel.PointToScreen(iMouseHoverControl.HoverPosition));
        }
Exemplo n.º 5
0
        void _hoverController_Hover(object sender, EventArgs e)
        {
            Vector2 pos    = _mainChoroplethMap.ConvertScreenCoordinatesToMapCoordinates(_hoverController.HoverPosition);
            int     region = _mapData.GetRegionId(pos.X, pos.Y);

            if (region != -1)
            {
                //_gavToolTip.Text = _mainWindow.DataHandler.RawDataProvider.RowIds[region];
                _gavToolTip.Text = _mapData.RegionFullNames[region];

                _gavToolTip.Show(new System.Drawing.Point(_hoverController.HoverScreenPosition.X - 5, _hoverController.HoverScreenPosition.Y - 5));
            }
        }
Exemplo n.º 6
0
        void _hoverController_Hover(object sender, EventArgs e)
        {
            // show the tooltip
            if (_scatterplot.GetIndexesAtLocation(_hoverController.HoverPosition).Count > 0)
            {
                int country = _scatterplot.GetIndexesAtLocation(_hoverController.HoverPosition).ElementAt(0);

                String countryInfo = _mainWindow.DataHandler.RawDataProvider.NaNColumns[0][0][country].ToString();
                int    z           = _mainWindow.yearSlider.Value;

                for (int i = 0; i < _mainWindow.DataHandler.RawDataProvider.ColumnHeaders.Count; i++)
                {
                    countryInfo += "\n" + _mainWindow.DataHandler.RawDataProvider.ColumnHeaders[i];
                    countryInfo += "   " + _mainWindow.DataHandler.getValueFromDataCube(i, country, z);
                }

                //_mainWindow.DataHandler.getValueFromDataCube(1,2,3);
                _gavToolTip.Text = countryInfo;
                _gavToolTip.Show(new System.Drawing.Point(_hoverController.HoverScreenPosition.X - 5, _hoverController.HoverScreenPosition.Y + 150));
            }
            //throw new NotImplementedException();
        }
Exemplo n.º 7
0
        void iMouseHoverControl_Hover(object sender, EventArgs e)
        {
            Vector2 v     = choroMap.ConvertScreenCoordinatesToMapCoordinates(iMouseHoverControl.HoverPosition);
            int     index = iMapData.GetRegionId(v);

            if (index != -1)
            {
                iToolTip.Hide();
                Country country = (Country)iDoc.GetDatabase().countries[iDoc.GetFilteredAcronyms()[index]];
                iToolTip.Text = iCountryNames[index]
                                + "\nMedian Age: " + country.medianAge
                                + "\nAlbum Releases: " + country.releases.Count
                                + "\nGDP(per capita): " + country.gdbPerCapita + "$"
                                + "\nUnemployment Rate: " + country.unemploymentRate + "%"
                ;
                iToolTip.Show(iMouseHoverControl.HoverPosition);
            }
        }
Exemplo n.º 8
0
        public void init()
        {
            //Manage the parallel coordinates plots
            _pcPlotVariables.Input = _mainWindow.DataHandler.MainDataCubeProvider;

            // mark the columns that can be interpolated
            IList <string> colHeaders    = _mainWindow.DataHandler.getColumnHeaders();
            List <string>  markedHeaders = new List <string>();

            for (int i = 0; i < colHeaders.Count; i++)
            {
                if (_mainWindow.DataHandler.InterpolationCols.Contains(i))
                {
                    markedHeaders.Add(String.Concat(colHeaders[i], _interpolationColMarker));
                }
                else
                {
                    markedHeaders.Add(colHeaders[i]);
                }
            }
            _pcPlotVariables.Headers = markedHeaders;

            _resetVarPCAxisColors();
            _pcPlotVariables.HeaderLayer.SelectedHeadersList.Add(MainWindow.PC_VAR_PLOT_INIT_VALUE);
            _pcPlotVariables.MarginRight = 35;

            _pcPlotYears.Input       = _mainWindow.DataHandler.YearDataCubeProvider;
            _pcPlotYears.Headers     = _mainWindow.DataHandler.getYearsAsList();
            _pcPlotYears.MarginRight = 35;
            _mainWindow.DataHandler.YearDataCubeProvider.VarIndex = MainWindow.PC_YEARS_PLOT_INIT_VALUE;
            SetMinMaxYearPC();

            _pcPlotVariables.ColorMap = _mainWindow.ColorMapHandler.MainColorMap;
            _pcPlotYears.ColorMap     = _mainWindow.ColorMapHandler.MainColorMap;

            _mainWindow.yearSlider.Minimum       = 0;
            _mainWindow.yearSlider.Maximum       = DataHandler.EndYear - DataHandler.StartYear;
            _mainWindow.yearSlider.TickFrequency = 1;
            _mainWindow.yearSlider.Value         = 0;

            UpdateVariablePCAxisList();

            // add to SAP manager
            _mainWindow.SaPManager.AddComponent(_pcPlotVariables);
            _mainWindow.SaPManager.AddComponent(_pcPlotYears);

            // add tooltip to pc plt
            _gavToolTip          = new Gav.Management.GavToolTip(_mainWindow);
            _gavToolTip.FadeTime = 150;

            // mouse controllers
            _hoverControllerVar  = new MouseHoverController(_mainWindow.getPCPanelVariables(), 1, 50);
            _hoverControllerYear = new MouseHoverController(_mainWindow.getPCPanelYears(), 1, 50);

            // dont know why I´m doing this but it makes the tooltip show at correct location the first time its called
            _gavToolTip.Show(new System.Drawing.Point(1, 1));
            _gavToolTip.Hide();

            // index visibility manager
            _pcPlotVariables.IndexVisibilityManager = _mainWindow.SharedVisibilityManager;
            _pcPlotYears.IndexVisibilityManager     = _mainWindow.SharedVisibilityManager;

            // selection color
            _pcPlotVariables.LineLayer.SelectedLineColor = _mainWindow.ColorMapHandler.SelectionColor;
            _pcPlotYears.LineLayer.SelectedLineColor     = _mainWindow.ColorMapHandler.SelectionColor;

            // listeners
            _pcPlotVariables.HeaderClicked      += new EventHandler <Gav.Event.IndexClickedEventArgs>(_pcPlotVariables_HeaderClicked);
            _pcPlotVariables.FilterChanged      += new EventHandler(_pcPlotVariables_FilterChanged);
            _pcPlotYears.FilterChanged          += new EventHandler(_pcPlotYears_FilterChanged);
            _pcPlotVariables.ComponentMouseUp   += new EventHandler <System.Windows.Forms.MouseEventArgs>(_pcPlotVariables_ComponentMouseUp);
            _pcPlotYears.ComponentMouseUp       += new EventHandler <System.Windows.Forms.MouseEventArgs>(_pcPlotYears_ComponentMouseUp);
            _mainWindow.yearSlider.ValueChanged += new EventHandler(yearSlider_ValueChanged);
            _hoverControllerVar.Hover           += new EventHandler(_hoverController_Hover_Var);
            _hoverControllerYear.Hover          += new EventHandler(_hoverController_Hover_Year);
            _hoverControllerVar.HoverEnd        += new EventHandler(_hoverController_HoverEnd_Var);
            _hoverControllerYear.HoverEnd       += new EventHandler(_hoverController_HoverEnd_Year);
            _pcPlotYears.Input.Changed          += new EventHandler(_pcPlotYears_Input_Changed);
            _pcPlotVariables.Input.Changed      += new EventHandler(_pcPlotVariables_Input_Changed);

            _mainWindow.varPCReset.Click  += new EventHandler(varPCReset_Click);
            _mainWindow.yearPCReset.Click += new EventHandler(yearPCReset_Click);

            _mainWindow.ShowClustersCheckbox.CheckedChanged += new System.EventHandler(checkBox2_CheckedChanged);
            _mainWindow.numberofClusters.ValueChanged       += new System.EventHandler(numberofClusters_ValueChanged);

            _mainWindow.varPCColZoomIn.Click    += new EventHandler(varPCZoomIn_Click);
            _mainWindow.varPCColResetZoom.Click += new EventHandler(varPCZoomOut_Click);


            // add to view manager
            _mainWindow.ViewManager.Add(_pcPlotVariables, _mainWindow.getPCPanelVariables());
            _mainWindow.ViewManager.Add(_pcPlotYears, _mainWindow.getPCPanelYears());
        }
Exemplo n.º 9
0
 private void InitializeGavToolTip()
 {
     //throw new NotImplementedException();
     gavToolTip = new GavToolTip(this);
     gavToolTip.SetPosition(new Point(0,0));
     gavToolTip.ToolTipBorderStyle = System.Windows.Forms.FormBorderStyle.None;
     gavToolTip.Show(new Point(0,0));
     gavToolTip.Hide();
 }
Exemplo n.º 10
0
        public void init()
        {
            //add controller for tooltips
            _gavToolTip          = new Gav.Management.GavToolTip(_mainWindow);
            _gavToolTip.FadeTime = 150;
            //create mouse hover controllers
            _hoverController          = new Gav.Graphics.MouseHoverController(_mainWindow.getScatterPanel(), 2, 50);
            _hoverControllerTableLens = new MouseHoverController(_mainWindow.getTableLensPanel(), 2, 50);
            //listeners FOR HOVER controller
            _hoverController.Hover             += new EventHandler(_hoverController_Hover);
            _hoverController.HoverEnd          += new EventHandler(_hoverController_HoverEnd);
            _hoverControllerTableLens.Hover    += new EventHandler(_hoverControllerTableLens_Hover);
            _hoverControllerTableLens.HoverEnd += new EventHandler(_hoverControllerTableLens_HoverEnd);
            // dont know why I´m doing this but it makes the tooltip show at correct location the first time its called
            _gavToolTip.Show(new System.Drawing.Point(1, 1));
            _gavToolTip.Hide();

            //Manage the 2D scatter plot
            _scatterplot.Name         = "ScatterPLot2D";
            _scatterplot.Input        = _mainWindow.DataHandler.MainDataCubeProvider;
            _scatterplot.Enabled      = true;
            _scatterplot.ColorMap     = _mainWindow.ColorMapHandler.MainColorMap;
            _scatterplot.GlyphMinSize = 0.025f;
            _scatterplot.GlyphSize    = 0.025f;

            //init the drop down combo boxes, ie set the possible variables to the list
            _mainWindow.ScatterXaxisValuesSelector.Items.AddRange(_mainWindow.DataHandler.getColumnHeaders().ToArray());
            _mainWindow.ScatterYaxisValuesSelector.Items.AddRange(_mainWindow.DataHandler.getColumnHeaders().ToArray());
            _mainWindow.ScatterSizeSelector.Items.AddRange(_mainWindow.DataHandler.getColumnHeaders().ToArray());

            //init scatterplot labels
            int initX = MainWindow.SCATTER_PLOT_X_INIT_VALUE;
            int initY = MainWindow.SCATTER_PLOT_Y_INIT_VALUE;

            _scatterplot.AxisYText  = "."; //fulis för att få den att inte synas
            _scatterplot.AxisIndexY = initY;
            _mainWindow.ScatterXaxisValuesSelector.SelectedIndex = initX;
            _mainWindow.yAxisLabel.Text    = _mainWindow.ScatterYaxisValuesSelector.Items[initY].ToString();
            _scatterplot.AxisXText         = "."; //fulis för att få den att inte synas
            _scatterplot.AxisIndexX        = initX;
            _scatterplot.ShowGrid          = true;
            _scatterplot.ShowAxisValues    = false;
            _scatterplot.NumberOfGridLines = 8;
            _scatterplot.AxisTextFont      = new System.Drawing.Font(_scatterplot.AxisTextFont.Name, 7.0f);
            _scatterplot.PaddingBottom     = 60;
            _scatterplot.PaddingTop        = 25;
            _mainWindow.ScatterYaxisValuesSelector.SelectedIndex = initY;
            _mainWindow.xAxisLabel.Text = _mainWindow.ScatterYaxisValuesSelector.Items[initX].ToString();


            // init table lens
            _tableLens.Input       = _mainWindow.DataHandler.MainDataCubeProvider;
            _tableLens.HeadersList = _mainWindow.DataHandler.getColumnHeaders();
            _tableLens.ColorMap    = _mainWindow.ColorMapHandler.MainColorMap;
            _tableLens.Enabled     = true;
            _tableLens.HeaderFont  = new System.Drawing.Font(_tableLens.HeaderFont.Name, 7.0f);


            _rowSorter       = new TableLensRowSorter();
            _rowSorter.Input = _mainWindow.DataHandler.MainDataCubeProvider;
            _rowSorter.IndexVisibilityManager = _mainWindow.SharedVisibilityManager;

            // index visibility manager
            _scatterplot.IndexVisibilityManager = _mainWindow.SharedVisibilityManager;
            _tableLens.IndexVisibilityManager   = _mainWindow.SharedVisibilityManager;

            // selection colors
            _scatterplot.SelectedGlyphColor = _mainWindow.ColorMapHandler.SelectionColor;

            // event listeners
            _mainWindow.SaPManager.AddComponent(_tableLens);
            _mainWindow.SaPManager.AddComponent(_scatterplot);
            _mainWindow.ScatterXaxisValuesSelector.SelectedIndexChanged += new EventHandler(ScatterXaxisValuesSelector_SelectedIndexChanged);
            _mainWindow.ScatterYaxisValuesSelector.SelectedIndexChanged += new EventHandler(ScatterYaxisValuesSelector_SelectedIndexChanged);
            _mainWindow.ScatterSizeSelector.SelectedIndexChanged        += new EventHandler(ScatterSizeSelector_SelectedIndexChanged);
            _tableLens.HeaderClicked += new EventHandler(_tableLens_HeaderClicked);

            // add to viewmanager
            _mainWindow.ViewManager.Add(_scatterplot, _mainWindow.getScatterPanel());
            _mainWindow.ViewManager.Add(_tableLens, _mainWindow.getTableLensPanel());
        }