This is a migrated thread and some comments may be shown as answers.

Object reference not set to an instance of an object

2 Answers 70 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Robert Schoen
Top achievements
Rank 1
Robert Schoen asked on 27 Jun 2014, 10:19 PM
I am getting an “Object reference not set to an instance of an object.” error when I attempt to add a barchart series to a chart.  The error is not very descriptive.   I am attaching a screen shot of the errordialog.   I have a sample project but I can’t seem to attach it.




Any help would be appreciated.


private void Plot()
{
Cursor startingCursor = this.Cursor;
this.Cursor = Cursors.WaitCursor;
//DataTable pivotData = GetPivotData();

DataTable pivotData = new DataTable("PivotData");
string filePath = Properties.Settings.Default.DataPath;
string schemaPath = Properties.Settings.Default.SchemaPath;
pivotData.ReadXmlSchema(schemaPath);
pivotData.ReadXml(filePath);
string xAxisFieldName = "PlanDate";
radChartView1.Series.Clear();
radChartView1.Axes.Clear();
bool xaxisesAdded = false;
DateTimeCategoricalAxis categoricalAxis = new DateTimeCategoricalAxis();

categoricalAxis.DateTimeComponent = DateTimeComponent.Date;
categoricalAxis.PlotMode = AxisPlotMode.BetweenTicks;
categoricalAxis.LabelFormat = "{0:m}";
categoricalAxis.LabelFitMode = AxisLabelFitMode.Rotate;
categoricalAxis.LabelRotationAngle = 270;


int intShippingColumns = 1;
int intInBoundColumns = 1;
int intOutBoundColumns = 1;
int intOnJobColumns = 1;
int intReceivingColumns = 1;

int intShippingColumnNumber = 0;
int intInBoundColumnNumber = 0;
int intOutBoundColumnNumber = 0;
int intOnJobColumnNumber = 0;
int intReceivingColumnNumber = 0;

foreach (DataColumn pivotColumn in pivotData.Columns)
{
if (pivotColumn.ColumnName.StartsWith("Shipping"))
{
intShippingColumns++;
}
else if (pivotColumn.ColumnName.StartsWith("OutBound"))
{
intOutBoundColumns++;
}
else if (pivotColumn.ColumnName.StartsWith("InBound"))
{
intInBoundColumns++;
}
else if (pivotColumn.ColumnName.StartsWith("Receiving"))
{
intReceivingColumns++;
}
else if (pivotColumn.ColumnName != xAxisFieldName)
{
intOnJobColumns++;
}
}
int colordif = 255 / pivotData.Columns.Count;
int colNum = 0;
foreach (DataColumn pivotColumn in pivotData.Columns)
{
if (pivotColumn.ColumnName != xAxisFieldName)
{
colNum++;
BarSeries barSeries = new BarSeries();
string seriesName = pivotColumn.ColumnName;
barSeries.Name = pivotColumn.ColumnName;
barSeries.LegendTitle = pivotColumn.ColumnName;
barSeries.ValueMember = pivotColumn.ColumnName;
//barSeries.ShowLabels = true;
barSeries.LabelFormat = "{0:#,###}";
barSeries.DataSource = pivotData;
barSeries.CategoryMember = "PlanDate";
barSeries.CombineMode = ChartSeriesCombineMode.Stack;
barSeries.HorizontalAxis = categoricalAxis;
int adjustedColor = colordif * colNum;
int red = 125;
int green = 125;
int blue = 125;
int intColorBias = 200;
if (seriesName.StartsWith("Shipping"))
{
intShippingColumnNumber++;
adjustedColor = intColorBias / intShippingColumns * intShippingColumnNumber;
green = intColorBias / 2;
blue = intColorBias - adjustedColor;
red = intColorBias - adjustedColor;
}
else if (seriesName.StartsWith("OutBound"))
{
intOutBoundColumnNumber++;
adjustedColor = intColorBias / intOutBoundColumns * intOutBoundColumnNumber;
green = intColorBias;
blue = intColorBias - adjustedColor;
red = intColorBias - adjustedColor;
}
else if (seriesName.StartsWith("InBound"))
{
intInBoundColumnNumber++;
adjustedColor = intColorBias / intInBoundColumns * intInBoundColumnNumber;
green = intColorBias - adjustedColor;
blue = intColorBias - adjustedColor;
red = intColorBias;
}
else if (seriesName.StartsWith("Receiving"))
{
intOutBoundColumnNumber++;
adjustedColor = intColorBias / intReceivingColumns * intReceivingColumnNumber;
green = (intColorBias - adjustedColor) / 2;
blue = (intColorBias - adjustedColor) / 2;
red = intColorBias;
}
else
{
intOnJobColumnNumber++;
adjustedColor = intColorBias / intOnJobColumns * intOnJobColumnNumber;
green = intColorBias - adjustedColor;
blue = intColorBias;
red = intColorBias - adjustedColor;
}
barSeries.BackColor = Color.FromArgb(red, green, blue);
barSeries.BorderColor = barSeries.BackColor;

//if (!xaxisesAdded)
//{
// DateTimeCategoricalAxis categoricalAxis = new DateTimeCategoricalAxis();

// categoricalAxis.DateTimeComponent = DateTimeComponent.Day;
// categoricalAxis.PlotMode = AxisPlotMode.BetweenTicks;
// categoricalAxis.LabelFormat = "{0:m}";
// categoricalAxis.LabelFitMode = AxisLabelFitMode.Rotate;
// categoricalAxis.LabelRotationAngle = 270;
// barSeries.HorizontalAxis = categoricalAxis;
// xaxisesAdded = true;
//}
if (seriesName != ".")
{
this.radChartView1.Series.Add(barSeries);  //Error dialog happens here but there is no stop.
}
}
}
radChartView1.ShowLegend = true;
radChartView1.ShowToolTip = true;

this.Cursor = startingCursor;
}

DataTableSchema
<?xml version="1.0" standalone="yes"?>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
  <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="PivotData" msdata:UseCurrentLocale="true">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="PivotData">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="PlanDate" type="xs:dateTime" minOccurs="0" />
              <xs:element name="_x002E_" type="xs:string" minOccurs="0" />
              <xs:element name="InBound" type="xs:string" minOccurs="0" />
              <xs:element name="On_x0020_Job" type="xs:string" minOccurs="0" />
              <xs:element name="OutBound" type="xs:string" minOccurs="0" />
              <xs:element name="Receiving" type="xs:string" minOccurs="0" />
              <xs:element name="Shipping" type="xs:string" minOccurs="0" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>

Sample Data
<?xml version="1.0" standalone="yes"?>
<DocumentElement>
  <PivotData>
    <PlanDate>2014-06-27T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <InBound>4</InBound>
    <OnJob>24</OnJob>
    <Receiving>2</Receiving>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-06-28T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <InBound>2</InBound>
    <OnJob>20</OnJob>
    <Receiving>8</Receiving>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-06-29T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>20</OnJob>
    <Receiving>4</Receiving>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-06-30T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>18</OnJob>
    <Receiving>4</Receiving>
    <Shipping>4</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-01T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>22</OnJob>
    <Shipping>5</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-02T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>23</OnJob>
    <Receiving>4</Receiving>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-03T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>25</OnJob>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-04T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>25</OnJob>
    <Receiving>2</Receiving>
    <Shipping>4</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-05T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>23</OnJob>
    <Receiving>6</Receiving>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-06T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>19</OnJob>
    <Receiving>4</Receiving>
    <Shipping>4</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-07T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>20</OnJob>
    <Receiving>3</Receiving>
    <Shipping>4</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-08T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>20</OnJob>
    <Receiving>4</Receiving>
    <Shipping>8</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-09T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <InBound>2</InBound>
    <OnJob>22</OnJob>
    <OutBound>2</OutBound>
    <Receiving>2</Receiving>
    <Shipping>4</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-10T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>26</OnJob>
    <Receiving>4</Receiving>
    <Shipping>6</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-11T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>32</OnJob>
    <Shipping>6</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-12T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>30</OnJob>
    <OutBound>2</OutBound>
    <Receiving>6</Receiving>
    <Shipping>5</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-13T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>35</OnJob>
    <Receiving>2</Receiving>
    <Shipping>4</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-14T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>37</OnJob>
    <OutBound>2</OutBound>
    <Shipping>4</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-15T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>33</OnJob>
    <Receiving>10</Receiving>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-16T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>33</OnJob>
    <Receiving>2</Receiving>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-17T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>31</OnJob>
    <Receiving>2</Receiving>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-18T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>26</OnJob>
    <Receiving>7</Receiving>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-19T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>24</OnJob>
    <Receiving>4</Receiving>
    <Shipping>4</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-20T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>22</OnJob>
    <Receiving>6</Receiving>
    <Shipping>4</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-21T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>26</OnJob>
    <Shipping>4</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-22T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <InBound>2</InBound>
    <OnJob>26</OnJob>
    <Receiving>2</Receiving>
    <Shipping>4</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-23T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <InBound>2</InBound>
    <OnJob>28</OnJob>
    <Receiving>2</Receiving>
    <Shipping>3</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-24T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>29</OnJob>
    <Receiving>4</Receiving>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-25T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>25</OnJob>
    <Receiving>6</Receiving>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-26T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>19</OnJob>
    <Receiving>6</Receiving>
    <Shipping>4</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-27T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>23</OnJob>
    <Shipping>4</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-28T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <InBound>2</InBound>
    <OnJob>21</OnJob>
    <Receiving>4</Receiving>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-29T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>14</OnJob>
    <Receiving>9</Receiving>
    <Shipping>12</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-30T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>26</OnJob>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-07-31T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>26</OnJob>
    <Receiving>2</Receiving>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-01T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>22</OnJob>
    <Receiving>6</Receiving>
    <Shipping>6</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-02T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>28</OnJob>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-03T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>28</OnJob>
    <Receiving>2</Receiving>
    <Shipping>1</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-04T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>19</OnJob>
    <Receiving>10</Receiving>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-05T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>17</OnJob>
    <Receiving>2</Receiving>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-06T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>11</OnJob>
    <Receiving>6</Receiving>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-07T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>9</OnJob>
    <Receiving>4</Receiving>
    <Shipping>8</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-08T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>15</OnJob>
    <Receiving>2</Receiving>
    <Shipping>8</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-09T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>22</OnJob>
    <Receiving>1</Receiving>
    <Shipping>4</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-10T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>26</OnJob>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-11T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>28</OnJob>
    <Shipping>4</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-12T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>32</OnJob>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-13T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>30</OnJob>
    <Receiving>2</Receiving>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-14T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>22</OnJob>
    <Receiving>8</Receiving>
    <Shipping>1</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-15T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>17</OnJob>
    <Receiving>6</Receiving>
    <Shipping>4</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-16T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>17</OnJob>
    <Receiving>4</Receiving>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-17T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>13</OnJob>
    <Receiving>4</Receiving>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-18T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>15</OnJob>
    <Shipping>6</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-19T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>19</OnJob>
    <Receiving>2</Receiving>
    <Shipping>6</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-20T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>24</OnJob>
    <Receiving>1</Receiving>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-21T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>24</OnJob>
    <Receiving>2</Receiving>
    <Shipping>8</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-22T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>32</OnJob>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-23T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>30</OnJob>
    <Receiving>4</Receiving>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-24T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>26</OnJob>
    <Receiving>4</Receiving>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-25T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>24</OnJob>
    <Receiving>4</Receiving>
    <Shipping>7</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-26T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>27</OnJob>
    <Receiving>4</Receiving>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-27T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>19</OnJob>
    <Receiving>10</Receiving>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-28T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>19</OnJob>
    <Shipping>6</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-29T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>23</OnJob>
    <Receiving>2</Receiving>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-30T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>25</OnJob>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-08-31T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>22</OnJob>
    <Receiving>5</Receiving>
    <Shipping>6</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-01T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>24</OnJob>
    <Receiving>4</Receiving>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-02T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>22</OnJob>
    <Receiving>2</Receiving>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-03T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>14</OnJob>
    <Receiving>8</Receiving>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-04T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>12</OnJob>
    <Receiving>2</Receiving>
    <Shipping>8</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-05T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>16</OnJob>
    <Receiving>4</Receiving>
    <Shipping>5</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-06T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>17</OnJob>
    <Receiving>4</Receiving>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-07T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>19</OnJob>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-08T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>19</OnJob>
    <Receiving>2</Receiving>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-09T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>19</OnJob>
    <Receiving>2</Receiving>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-10T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>21</OnJob>
    <Shipping>8</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-11T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>28</OnJob>
    <Receiving>1</Receiving>
    <Shipping>6</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-12T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>26</OnJob>
    <Receiving>8</Receiving>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-13T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>22</OnJob>
    <Receiving>4</Receiving>
    <Shipping>6</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-14T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>22</OnJob>
    <OutBound>2</OutBound>
    <Receiving>4</Receiving>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-15T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>22</OnJob>
    <Receiving>2</Receiving>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-16T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>20</OnJob>
    <Receiving>2</Receiving>
    <Shipping>1</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-17T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>19</OnJob>
    <Receiving>2</Receiving>
    <Shipping>4</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-18T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>17</OnJob>
    <Receiving>6</Receiving>
    <Shipping>4</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-19T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>17</OnJob>
    <Receiving>4</Receiving>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-20T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>19</OnJob>
    <Shipping>10</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-21T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>25</OnJob>
    <Receiving>4</Receiving>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-22T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>24</OnJob>
    <Receiving>3</Receiving>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-23T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <InBound>2</InBound>
    <OnJob>16</OnJob>
    <OutBound>2</OutBound>
    <Receiving>6</Receiving>
    <Shipping>4</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-24T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>20</OnJob>
    <Receiving>4</Receiving>
    <Shipping>2</Shipping>
  </PivotData>
  <PivotData>
    <PlanDate>2014-09-25T00:00:00-06:00</PlanDate>
    <_x002E_>0</_x002E_>
    <OnJob>22</OnJob>
  </PivotData>
</DocumentElement>

2 Answers, 1 is accepted

Sort by
0
Robert Schoen
Top achievements
Rank 1
answered on 27 Jun 2014, 10:23 PM
I forgot to include version information.
Teleik Version UI for WinForms Q2 2014 runtime version v4.0.30319
Visual Studio 2012 Update 4
0
Lance | Senior Manager Technical Support
Telerik team
answered on 30 Jun 2014, 04:37 PM
Hi Robert,

The problem is due to barSeries.VerticalAxis being null when you add it to radChartView1. You need to defining a vertical axis of a series is needed before you can add it to a ChartView.

You can define the vertical series where you defined the categoricalAxis and use it for the barSeries. For example:

radChartView1.Axes.Clear();
...
 
DateTimeCategoricalAxis categoricalAxis = new DateTimeCategoricalAxis();
categoricalAxis.DateTimeComponent = DateTimeComponent.Date;
categoricalAxis.PlotMode = AxisPlotMode.BetweenTicks;
categoricalAxis.LabelFormat = "{0:m}";
categoricalAxis.LabelFitMode = AxisLabelFitMode.Rotate;
categoricalAxis.LabelRotationAngle = 270;
 
LinearAxis verticalAxis = new LinearAxis();
//set your preferred properties for the linear axis
 
//add the series to the ChartView
radChartView1.Axes.Add(verticalAxis);
radChartView1.Axes.Add(categoricalAxis);
 
//further down in the method in the foreach loop, assign the axes to the series
barSeries.VerticalAxis = radChartView1.Axes[0] as LinearAxis;
barSeries.HorizontalAxis = radChartView1.Axes[1] as DateTimeCategoricalAxis;


If you have any further difficultly, please reply to the Support Ticket you have submitted for this issue and we will follow up there.

Kind Regards,
Lance | Senior Support Specialist
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
ChartView
Asked by
Robert Schoen
Top achievements
Rank 1
Answers by
Robert Schoen
Top achievements
Rank 1
Lance | Senior Manager Technical Support
Telerik team
Share this question
or