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
305
Problem displaying BoxChart using XamWebChart v10.3
posted

Hi,

I am trying to develop a BoxChart based on some measure values. But getting some message in chart area "XamWebChart Warning: The box chart needs Min, Max, Q1, Q2 and Q3 values. The values have to be set for every data point using Chartparameters collection.".

I have already supplied the required values. But still getting the message.

Can you please provide me with some solution.

Following is the code i am using to generate DataPoints along with it's ChartParameters:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

// to use the zoombar control with chart set the following properties on the axis

 

 

 

if (this

.PivotGrid.DataSource.Result.RowAxis.Tuples.Count > 5)

{

theChart.Axes.Clear();

 

 

 

Axis primXAxis = new Axis

();

primXAxis.AxisType =

 

 

AxisType

.PrimaryX;

primXAxis.ScrollEnabled =

 

 

true

;

primXAxis.ScrollPosition = 0.21;

primXAxis.ScrollScale = 0.17;

theChart.Axes.Add(primXAxis);

theChart.ZoomRectangle.Enabled =

 

 

true

;

}

 

 

 

Series series = new Series

();

series.ChartType =

 

 

ChartType

.Box;

 

 

 

for (int

i = 0; i < lstOCol.Count; i++)

{

 

 

 

var MinValue = ((ObservableCollection<DataPoint

>)lstOCol[i]).Min(p => p.Value);

 

 

 

var MaxValue = ((ObservableCollection<DataPoint

>)lstOCol[i]).Max(p => p.Value);

 

 

 

ChartParameter chartParams = new ChartParameter

();

 

 

 

DataPoint dd = new DataPoint

();

 

 

 

 

foreach (var x in ((ObservableCollection<DataPoint

>)lstOCol[i]))

{

chartParams.Type = Infragistics.Silverlight.Chart.

 

 

ChartParameterType

.Min;

chartParams.Value = MinValue;

dd.ChartParameters.Add(chartParams);

chartParams.Type = Infragistics.Silverlight.Chart.

 

 

ChartParameterType

.Max;

chartParams.Value = MaxValue;

dd.ChartParameters.Add(chartParams);

chartParams.Type = Infragistics.Silverlight.Chart.

 

 

ChartParameterType

.Q1;

chartParams.Value = x.Value;

dd.ChartParameters.Add(chartParams);

chartParams.Type = Infragistics.Silverlight.Chart.

 

 

ChartParameterType

.Q2;

chartParams.Value = x.Value;

dd.ChartParameters.Add(chartParams);

chartParams.Type = Infragistics.Silverlight.Chart.

 

 

ChartParameterType

.Q3;

chartParams.Value = x.Value;

 

dd.ChartParameters.Add(chartParams);

}

 

series.DataPoints.Add(dd);

series.Label =

 

 

this

.PivotGrid.DataSource.Result.ColumnAxis.Tuples[i].Members[0].ToString();

Following is the message i am getting:

 

Thanks for the help in advance.

Thanks & Regards,
Sachin Pandya.

  • 335
    posted

    Hello,

     

    Have you added the new series you created to your chart - theChart.Series.Add(series); ? I could not find such code in the snipper you posted.

    Also try setting chartParams = new ChartParameter (); after each time you added the parameter to the DataPoint ChartParameters collection.

     

    foreach (var x in ((ObservableCollection<DataPoint>)lstOCol[i]))
    {
    chartParams.Type = Infragistics.Silverlight.Chart.ChartParameterType.Min;
    chartParams.Value = MinValue;
    dd.ChartParameters.Add(chartParams);

    chartParams = new ChartParameter ();
    chartParams.Type = Infragistics.Silverlight.Chart.ChartParameterType.Max;
    chartParams.Value = MaxValue;
    dd.ChartParameters.Add(chartParams);

    chartParams = new ChartParameter ();
    chartParams.Type = Infragistics.Silverlight.Chart.ChartParameterType.Q1;
    chartParams.Value = x.Value;
    dd.ChartParameters.Add(chartParams);

    chartParams = new ChartParameter ();
    chartParams.Type = Infragistics.Silverlight.Chart.ChartParameterType.Q2;
    chartParams.Value = x.Value;
    dd.ChartParameters.Add(chartParams);

    chartParams = new ChartParameter ();
    chartParams.Type = Infragistics.Silverlight.Chart.ChartParameterType.Q3;
    chartParams.Value = x.Value;
    dd.ChartParameters.Add(chartParams);
    }

    series.DataPoints.Add(dd);
    series.Label = this.PivotGrid.DataSource.Result.ColumnAxis.Tuples[i].Members[0].ToString();

    theChart.Series.Add(series);

     

     

    Hope this helps,

    Boyan