Home Forums WinForms controls Xceed Chart for WinForms Chart datasource and selection

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #19049 |

    Hi.

    I display side by side chart and grid.The grid show the vales of the chart.In my pervious application when the user select row the user see in the chart the value he select how I can do it in the Xceed?

    Imported from legacy forums. Posted by nadav (had 4662 views)

    User (Old forums)
    Member
    Post count: 23064

    What do you mean by “the user see in the chart the value he selected”?  If you want to highlight a specific DataPoint in the chart, it is not possible with all series type.  For example, it is not possible to “highlight” a DataPoint in a LineSeries.  If you have a PieSeries and want to explode a pie segment, or a BarSeries and change the color a the corresponding bar, then you can handle the CurrentCellChanged event, and in the event handler, get the row index, and retrieve the corresponding object to change in the required collection.

    For example, for a BarSeries where you change the color of the bar when selecting the corresponding value in the grid : 

        private BarSeries bar;

        private void Form1_Load( object sender, EventArgs e )
        {
          chartGridControl1.BindToChart = true;
          chartGridControl1.ChartControl = chartControl1;
          chartGridControl1.DataSeriesGrid.CurrentCellChanged += new EventHandler( DataSeriesGrid_CurrentCellChanged );

          Chart chart = chartControl1.Charts[ 0 ];

          bar = ( BarSeries )chart.Series.Add( SeriesType.Bar );
          bar.Appearance.FillMode = AppearanceFillMode.DataPoints;
          bar.Add( 10, “”, new FillEffect( Color.DeepPink ) );
          bar.Add( 20, “”, new FillEffect( Color.DeepPink ) );
          bar.Add( 30, “”, new FillEffect( Color.DeepPink ) );
          bar.Add( 40, “”, new FillEffect( Color.DeepPink ) );
        }

        private Color previousColor;
        private int index = -1;

        void DataSeriesGrid_CurrentCellChanged( object sender, EventArgs e )
        {
          if( index > -1 )
          {
            ( ( FillEffect )bar.Appearance.FillEffects[ index ] ).Color = previousColor;
          }
          index = chartGridControl1.DataSeriesGrid.CurrentRowIndex;
          previousColor = ( ( FillEffect )bar.Appearance.FillEffects[ index ] ).Color;
          ( ( FillEffect )bar.Appearance.FillEffects[ index ] ).Color = Color.DeepSkyBlue;
          chartControl1.Refresh();
        }

    Imported from legacy forums. Posted by André (had 432 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi I don’t want to  highlight a specific DataPoint in the chart I want like in the data cursor example to see a little circle in the datapoint.

    Imported from legacy forums. Posted by nadav (had 461 views)

    User (Old forums)
    Member
    Post count: 23064

    Can you provide more details on what you mean by “a little circle” (may be a screenshot), and the exact path to the sample you are referring to, because I don’t see any circles in the Data Cursor sample of the Chart Explorer.

    Imported from legacy forums. Posted by André (had 331 views)

    User (Old forums)
    Member
    Post count: 23064

    Like in the image but instead of the cross I want to show a circle.

    Imported from legacy forums. Posted by nadav (had 494 views)

    User (Old forums)
    Member
    Post count: 23064

    I’m not use the chartGridControl I use another Grid.

    I can now what are the values haw I find the datapoint?

    (this is replay to your post from 25/11/2008 2:04)

    Imported from legacy forums. Posted by nadav (had 550 views)

    User (Old forums)
    Member
    Post count: 23064

    It is not possible to have circles instead of the crosses.  As I stated before, it is not possible to highlight a DataPoint in a LineSeries.

    For the grid, if you look at the code snippet, you can see that I use the index of the data row that is clicked in the grid, and use it to retrieve the DataPoint in the chart, since the index is the same.  Simply do the same thing in the other grid you are using, from the selected row, retrieve the index that corresponds to the DataPoint.

    Imported from legacy forums. Posted by André (had 5295 views)

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.