Search code examples
c#chartshighchartsdevexpressdevexpress-windows-ui

set chart type property in devexpress chart control c#


I created a chart in my dashboard of my program as you can see :

enter image description here

I initialize the data with this code in my load_form

   chartControlMIVBaseDateTime.DataSource = _materialIssueVoucherRepository.ViewImivBasedOnDates().ToList();


            // Generate a data table and bind the chart to it.

            // Specify data members to bind the chart's series template.
            chartControlMIVBaseDateTime.SeriesDataMember = "Count";
            chartControlMIVBaseDateTime.SeriesTemplate.ArgumentDataMember = "DateTime";
            chartControlMIVBaseDateTime.SeriesTemplate.ValueDataMembers.AddRange(new string[] { "Count" });

The Count in numerical ,but the problem is i set the chart to show this type of presentation

enter image description here

But it doesn't work


Solution

  • Final code

     Series series = new Series("Series1", ViewType.Spline);
    
                chartControlMIVBaseDateTime.Series.Add(series);
    
                // Generate a data table and bind the series to it.
                series.DataSource = _materialIssueVoucherRepository.ViewImivBasedOnDates().ToList();
    
                // Specify data members to bind the series.
                series.ArgumentScaleType = ScaleType.DateTime;
                series.ArgumentDataMember = "DateTime";
                series.ValueScaleType = ScaleType.Numerical;
                series.ValueDataMembers.AddRange(new string[] { "Count" });