Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
Ultragrid with UltraChart as a column
posted

Hi,

I am trying to a create a grid with many bound columns and I also need an additional column that displays UltraChart.

Is there a sample to demonstrate how to implement this?

  • 18204
    Suggested Answer
    Offline posted

    Hello,

    You can accomplish this by setting the Image of the chart as the ImageBackground of the grid's cell. This avoids some of the overhead of having the UltraChart control render. You can set this in the InitializeRow event like the below snippet:

    private void ultraGrid1_InitializeRow(object sender, InitializeRowEventArgs e)
    {
        if (e.Row.Cells.Exists("Data"))
        {
            List<double> data = e.Row.GetCellValue("Data") as List<double>;
    
            UltraChart chart = new UltraChart();
            chart.Data.ZeroAligned = true;
            chart.Name = "chart";
            chart.Height = 200;
            chart.Width = 300;
            chart.DataSource = data;
            chart.DataBind();
    
            e.Row.Cells["Activity"].Appearance.ImageBackground = chart.Image;
        }
    }
    

    I have also attached a sample that demonstrates this. If you need any further assistance with this, please let me know and I will be glad to help.

    6574.WindowsFormsApplication1.zip