Chart Wizard Issues

Using the chart wizard on an access query.  Followed the documentation.  Y-Axis is an integer and and X-Axis is a string.  First off, it doesn't show any data during the data source selection.  I was able to assign column values to X & Y however no matter what I chose as the value type for X, it would only display a number.  

I also noticed going back into the chart wizard it doesn't seem to keep the changes that you previously made.  I'm on Windows 10, Visual Studio 10 on a syncfusion winforms vb.net project.

4 Replies

JE Jeff July 19, 2018 01:30 PM UTC

Even if I start a new project and use code, I'm getting weird results.  Here is the code:

 Dim con As OleDbConnection = New OleDbConnection("Provider=Microsoft.jet.oledb.4.0;data source=f:\access\keystone-es.mdb")
        Dim cmd As New OleDbCommand
        cmd.CommandType = CommandType.StoredProcedure
        cmd.CommandText = "qryMajorClassTotal"
        cmd.Connection = con
        con.Open()
        Dim da As OleDbDataAdapter = New OleDbDataAdapter(cmd)
        Dim ds As DataSet = New DataSet()
        da.Fill(ds, "Table1")
        con.Close()
        ChartControl1.Indexed = True
        ChartControl1.ChartArea.PrimaryYAxis.Indexed = True
        Dim model = New ChartDataBindModel(ds, "Table1")
        model.XName = "MajorClassName"
        model.YNames = New String() {"SumOfEXTCOST"}
        Dim series = ChartControl1.Model.NewSeries("DataBinding")
        series.Text = series.Name
        series.Type = ChartSeriesType.Column
        series.SeriesModelImpl = model
        ChartControl1.Series.Add(series)
        Dim yAxisLabelModel = New ChartDataBindAxisLabelModel(ds, "Table1")
        yAxisLabelModel.LabelName = "SumOfEXTCOST"
        ChartControl1.ChartArea.PrimaryYAxis.LabelsImpl = yAxisLabelModel
        ChartControl1.ChartArea.PrimaryYAxis.ValueType = ChartValueType.Double
        Dim XAxisLabelModel = New ChartDataBindAxisLabelModel(ds, "Table1")
        XAxisLabelModel.LabelName = "MajorClassName"
        ChartControl1.ChartArea.PrimaryXAxis.LabelsImpl = XAxisLabelModel
        ChartControl1.ChartArea.PrimaryXAxis.ValueType = ChartValueType.Category
        ChartControl1.Text = "Chart DataBinding Sample(Bar Chart)"

and here is the result.  There should be 10 columns with numbers on the Y axis and text on the X axis.




JE Jeff July 19, 2018 02:51 PM UTC

I now have it showing the data correctly but cannot get the x-axis to show text, it's just showing a number (from 0 to 19) which is the number of rows in my dataset.  Any help?

   Try

            Dim con As OleDbConnection = New OleDbConnection("Provider=Microsoft.jet.oledb.4.0;data source=f:\access\keystone-es.mdb")
        Dim cmd As New OleDbCommand
        cmd.CommandType = CommandType.StoredProcedure
        cmd.CommandText = "qryMajorClassTotal"
        cmd.Connection = con
        con.Open()
        Dim da As OleDbDataAdapter = New OleDbDataAdapter(cmd)
        Dim ds As DataSet = New DataSet()
        da.Fill(ds, "Table1")
        con.Close()
            Dim model = New ChartDataBindModel(ds, "Table1")
        model.XName = "MajorClassName"
        model.YNames = New String() {"SumOfEXTCOST"}
            'Dim series = ChartControl1.Model.NewSeries("DataBinding")
            Dim series As New ChartSeries("Data Bound Series")
            series.SeriesModelImpl = model
            series.Text = series.Name
            series.Type = ChartSeriesType.Column
            ChartControl1.Series.Add(series)
            Dim yAxisLabelModel = New ChartDataBindAxisLabelModel(ds, "Table1")
        yAxisLabelModel.LabelName = "SumOfEXTCOST"
        ChartControl1.ChartArea.PrimaryYAxis.LabelsImpl = yAxisLabelModel
        ChartControl1.ChartArea.PrimaryYAxis.ValueType = ChartValueType.Double
        Dim XAxisLabelModel = New ChartDataBindAxisLabelModel(ds, "Table1")
            XAxisLabelModel.LabelName = "MajorClassName"
            ChartControl1.ChartArea.PrimaryXAxis.LabelsImpl = XAxisLabelModel
            ChartControl1.ChartArea.PrimaryXAxis.ValueType = ChartValueType.Category
            ChartControl1.Text = "Chart DataBinding Sample(Bar Chart)"
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try


JE Jeff July 20, 2018 05:33 PM UTC

Feels like i'm talking to myself..  Hoping to get some advice from someone.  I was able to produce the text labels by changing the valuetype to custom however now the graph is 'stacked'.  Any advice?




SK Sanjith Kesavan Syncfusion Team July 23, 2018 11:04 AM UTC

Hi Jaco, 

Sorry for the delay. We have analyzed your query and code example. Since you are binding data for chart using “ChartDataBindModel”, you have to set “ValueType” of the x-axis as “Custom”. Otherwise it is considered as indexed axis and labels will be displayed from 0 for each point in the chart. But while setting “ValueType” as “Custom”, labels won’t stacked with each other. Please find the below code example to customize x-axis. 

[VB] 
chart.PrimaryXAxis.ValueType = ChartValueType.Custom 
chart.PrimaryXAxis.PointOffset = 1 
chart.PrimaryXAxis.Range = New MinMaxInfo(0, table.Rows.Count + 1, 1) 

In the below code, we have set the “ValueType” of axis as “Custom” and “PointOffset” as 1. This “PointOffset” is used to leave one interval space between axis and first point drawn in the chart. And also, we have set range from 0 for x-axis. Now find the output below. 
 

In the below link, we have attached sample for your reference.  
Sample link: chart-sample 

Still you are facing any concern, kindly let us know by modifying the attached sample to reproduce the reported issue. This will be helpful for us to find and fix the issue sooner.  

Thanks, 
Sanjith.  


Loader.
Up arrow icon