0

我有两个关于AspxPivotGrid.

当我使用自定义窗口并在“行区域”和“数据区域”中添加列并更新报告时。网格正确生成,但图表未生成。但是,当您在“列区域”中添加字段时,会生成图表。

看起来该图仅在至少指定一列时生成,即使“数据区域”标题正是我们需要的数据。我已经用您网站上的图形演示对此进行了模拟。这是预期的行为吗?

其次,当我将 DateTime 添加到“行区域”和字符串“列区域”时,这很好。然后我交换列,再次枢轴很好。再次将其切换回来,您会收到以下错误:

System.ArgumentException: The type of the "Arguments" argument data member isn't compatible with the date-time scale.

at DevExpress.XtraCharts.SeriesBase.CheckArgumentDataMember(Object dataSource, String dataMember, ScaleType argumentScaleType)

有什么建议/解决方案吗?

4

2 回答 2

1

如果您在“行区域”和“数据区域”中有字段,但在“列区域”中没有,则网格会显示列总计。ShowColumnGrandTotals您可以通过设置属性在图表中显示这些,例如:

ASPxPivotGrid1.OptionsChartDataSource.ShowColumnGrandTotals = True

不显示总计的默认值是可以理解的,因为大多数图表显示:

  • 按行或列字段分组的聚合值,但没有总计,或
  • 仅来自行或列的总计值。
于 2011-06-10T14:12:38.913 回答
0

我有同样的错误:

“参数”参数数据成员的类型与数字刻度不兼容

“参数”参数数据成员的类型与日期时间刻度不兼容

当用户在透视网格中按列更改行或反之亦然时,就会发生这种情况。为了解决这个问题,我尝试了这段代码,它对我有用:

        //Always make the chart visible then perform DataBind() //Sempre deixar o gráfico visivel e depois executar o método DataBind()
        try
        {
            dxGrafico.Visible = true;
            dxGrafico.RefreshData();
            dxGrafico.DataBind();
        }
        catch (Exception ex)
        {
            //Try to fix the error: The type of the "Arguments" argument data member isn't compatible with the <data type> scale //Tentar corrigir o Erro
            bool bTeste = false;
            bTeste = Ajuste_Grafico_ScaleType(ex);

            //If not fix the argument scale type, then show error message label //Se não conseguir corrigir , acrescenta um label com texto da mensagem de erro
            if (!bTeste)
            {
                //Make the chart not visible and Add a label on the Page Control that the owners the chart //Deixar o gráfico invisível e exibir o label com mensagem no objeto PageControl que contém o gráfico
                dxGrafico.Visible = false;
                try
                {
                    //Error Message (Mensagem de Erro)    
                    ASPxLabel lbl = new ASPxLabel();
                    lbl.ID = "lblMensagemErroGrafico";
                    lbl.Text += "\n\n" + "ATENÇÃO: Não Foi possível Processar o Gráfico" + "";
                    lbl.Text += "\n\n" + "Tente utilizar outro tipo de Gráfico" + "";
                    lbl.Text += "\n\n" + ex.Message + ""; //lbl.Text += "\n\n" + ex.ToString() + "";
                    this.pgControl.TabPages[1].Controls.Add(lbl);
                }
                catch (Exception ex1) { }
            }

        }

    //method Try to fix the error 
    private bool Ajuste_Grafico_ScaleType(Exception exOrigem)
    {
        //Try to fix error argument ArgumentScaleType (Tenta ajustar erro)
        bool saida = false;

        try
        {

            //Auto
            try
            {
                dxGrafico.SeriesTemplate.ArgumentScaleType = ScaleType.Auto;
                dxGrafico.DataBind();
                dxGrafico.SeriesTemplate.ValueScaleType = ScaleType.Auto;
                dxGrafico.DataBind();
                saida = true;
                return saida;
            }
            catch (Exception e) { }

            //Numeric
            try
            {
                int n = exOrigem.Message.ToString().IndexOf("Numeric", 0, StringComparison.OrdinalIgnoreCase);
                if (n >= 0)
                {
                    dxGrafico.SeriesTemplate.ArgumentScaleType = ScaleType.DateTime;
                    dxGrafico.DataBind();
                    dxGrafico.SeriesTemplate.ValueScaleType = ScaleType.DateTime;
                    dxGrafico.DataBind();
                    saida = true;
                    return saida;
                }
            }
            catch (Exception e) { }


            //Date Time
            try
            {
                int n = exOrigem.Message.ToString().IndexOf("Date", 0, StringComparison.OrdinalIgnoreCase);
                if (n >= 0)
                {
                    dxGrafico.SeriesTemplate.ArgumentScaleType = ScaleType.Numerical;
                    dxGrafico.DataBind();
                    dxGrafico.SeriesTemplate.ValueScaleType = ScaleType.Numerical;
                    dxGrafico.DataBind();
                    saida = true;
                    return saida;
                }
            }
            catch (Exception e) { }

        }
        finally
        {

        }

        return false;
    }

它适用于大多数图表类型,但FullStakedLine发生了另一个与此处无关的错误。

于 2013-04-25T00:26:08.927 回答