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
295
X Axis ignoring label formatting
posted

Hi

The X axis seems to be ignoring label formatting, please have a look at my code below and see if something's wrong.


       

        Dim ds As New System.Data.DataSet
        ds.ReadXml("C:\TestXMLBinding\TestXMLBinding\Data\ScatterplotData.xml")

        Dim axisX As New Infragistics.Windows.Chart.Axis
        axisX.AxisType = AxisType.PrimaryX
        axisX.Label.Format = "{0:n3}"
        XamChart1.Axes.Add(axisX)

        Dim axisY As New Infragistics.Windows.Chart.Axis
        axisY.AxisType = AxisType.PrimaryY
        axisY.Label.Format = "{0:n1}"
        XamChart1.Axes.Add(axisY)


        Dim s As Infragistics.Windows.Chart.Series = New Infragistics.Windows.Chart.Series
        s.DataSource = ds.Tables(0)
        s.DataMapping = "label=x;value=y"
        s.ChartType = ChartType.Column
        XamChart1.Series.Add(s)

       

This is my data:

<SERIES>
  <VALUE X="1.0013" Y="0"/>
  <VALUE X="1.0021" Y="1"/>
  <VALUE X="1.0033" Y="2"/>
  <VALUE X="1.0046" Y="5"/>
  <VALUE X="1.0052" Y="8"/>
  <VALUE X="1.0062" Y="2"/>
  <VALUE X="1.0078" Y="1"/>
 </SERIES>

 

  • 28496
    Offline posted

    most likely this is happening because the X and Y values are retrieved as a string at some point, so the double formatting string is not accepted.  this may be a problem with the control ... but try changing the DataType property of your DataColumns (in ds.Tables(0).Columns) to double or something numeric.