How to create a chart from a GridControl - winforms

Prior asking this question, i read similar post such as:
Create chart from DataGridView
Get data from DataGridView to Chart
Creating chart from datagridview C#
making chart from datagridview
C# Using data from DataGridView in a Chart
But i am still unable to show my datagridview data to a my chart. I am using xtragrid and Xtracharts controls to achieve my task and in my datagridview, i have some unbound columns.
here is the code i have tried to use
private void ChartData()
{
Series S = new Series();
LineSeriesView view = new LineSeriesView();
S.View = view;
ProdchartControl.DataSource = ProdgridControl.DataSource;
S.ArgumentDataMember = "Prod Date";
S.ValueDataMembersSerializable = "Orange prod";
ProdchartControl.SeriesDataMember = "ProdID";
ProdchartControl.Series.Add(S);
}
your assitance will be welcomed.
Thanks.

ChartControl provides built-in integration with the GridControl component (see Integration with a Data Grid, Vertical Grid, Tree List or List Box via ControlRowSource).
For an example with unbound fields, refer to the How to display data from an unbound column displayed in the grid control ticket.

Related

Custom Dynamic Grid

I am trying to display items in a grid however the rows and the columns should be generated dynamically. I actually implemented a custom control that derives from Grid control and provide additional properties such as RowCount.
Here is a picture of the grid generated by my custom control using two dimensinal string array as datasource:
But i think my control consumes more than needed resources because it simply destroys column and row definitions and recreates them. Is there any simpler way to implement that control?
You don't need to create a custom control to do that for you... you can use a standard DataGrid. There have been a number of questions on displaying dynamic data in a DataGrid. Please take a look at some of these posts:
How do I bind a WPF DataGrid to a variable number of columns?
DataGridColumn Binding with Dynamically Generated Data
Visualizing 2D Data in a Table
Displaying multidimensional data in WPF

Grid like control with cell level customization for .net

I am looking for a grid like control either WinForm or WPF.
I have collection of a array of class named PropertyInfo. This class exposes PropertyValue and PropertyType as properties. PropertyValue can be any arbitrary object.This collection of array need to be shown in grid layout , where I need to have control on each cell. For example based on PropertyType , the cell could be combobox or checkbox or hyperlink cell or even could be a readonly. So I need create cells in code-behind by iterating collection and array values in each item.
Other requirements are :
Should be a free or standard .net control.
Should be supported in .net 3.5.
Should support hosting custom control in cell to edit cell value.
Ex: Color Picker to edit color.
Should notify value change to perform extra validations like max
text length or numeric range.
Should allow to retrieve cell values which are modified.
It would be nice if cell properties like border, foreground and
background color can be defined.
In my search I came across WinForm DataGridView. This control is more suitable if data is in DataSet and combobox is available when a column type is DataGridViewComboBoxColumn. Not sure if combobox can be placed randomly in any cell via code. Another control named Sourcegrid is on codeplex. Not sure if it can full fill all above requirements. Please provide suggestions. Thanks in advance.

Why Datagrid is not showing data?

I have an application in C# + WPF and I need to fill a datagrid.
I tried to fill the DataGrid using its property ItemsSource.
DataGrid.ItemsSource = <ElementList>;
Where ElementList is a List of strings.
When I run it, it generates a row for each element of the list but it does not show anything.
Does your data have properties? Fields will not work, also AutoGenerateColumns needs to be true unless you created columns manually.

Is it possible to add two or more repository controls in devepxress grid control

Hey i am dealing with winform(c#) application. i am using Devexpress Grid Control.
Is it possible to have two or more repository controls in grid control column for edit purpose.
eg.. say like a textbox and combo box in a grid column.(this is possible in web application by adding item templates to the grid column)
Is this possible or any other way to get this done?
You can set the GridColumn.ColumnEdit property to specifying the editor used to edit a column's value

WPF drag and drop to DataGrid

I have been searching the internet high and low but can't find some examples that can help me.
I'm developing an application in wpf, in it I use a DataGrid; each cell has a DataTemplate with and image, in a mosaic style; on the side of the grid I have some tiles to use on the grid.
I'm able to drag the tiles but can't drop them on the grid because I can't find the cell to which make the drop. Is there a way to get a cell position from the the drag events?
Thanks
I am assuming you suscribed to the drop event on the DataGrid.
Since you have a DataTemplate for each cell, you could subscribe to the drop event from the cell and you should be able to do the modification you want via e.Source.
If you need to you could define a different DataTemplate for each column so that you can figure at the column and then modifiy the data via
BusinessObject row = ((UIElementResponsibleForTeDrop)e.Source).DataContext;

Resources