dcsimg
Results 1 to 4 of 4

Thread: Advice on Binding Data to Chart

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2016
    Posts
    279

    Advice on Binding Data to Chart

    Hi. I kinda need some advice on binding data to line chart. I have two options for my idea.

    1. Using Datsource.

    2. Bind data from DGV to Chart.

    After I binded the data to chart, i want to have a marker in every data and check if the data pass the validation for it, if it doesn't pass the validation, the marker will become red. Is it possible?

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    104,742

    Re: Advice on Binding Data to Chart

    Forget anything about the grid. You should use a DataTable as the data source for the chart. Whether or not you're using the same DataTable as the data source for a grid is irrelevant to the chart.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2016
    Posts
    279

    Re: Advice on Binding Data to Chart

    Quote Originally Posted by jmcilhinney View Post
    Forget anything about the grid. You should use a DataTable as the data source for the chart. Whether or not you're using the same DataTable as the data source for a grid is irrelevant to the chart.
    I will do that. But then is the chart still possible to manipulate the appearance after I use data source? Just like what I said if the data did not pass the validation, the dp will become red

  4. #4
    PowerPoster
    Join Date
    Oct 2010
    Posts
    2,141

    Re: Advice on Binding Data to Chart

    Just some info.

    The MS DataVisualization.Charting.Chart's data binding mechanism is not a true binding system as there is no automatic updating of the DataPoints to reflect changes in the underlying source. It would more correctly named CreateDataPointsFromDataSource. This is why you must call one of the DataBind methods any time you want the chart to show changes in the underlying data. Calling the DataBind method causes the existing chart DataPoints to be cleared and the underlying source to be enumerated to create a new set of DataPoints.

    Because of this, you will need to set the DataPoint MarkerColor for the point when the data changes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width