私は同じエラーを抱えていました:
"Arguments" 引数データ メンバーの型は、数値スケールと互換性がありません
"Arguments" 引数データ メンバーの型は、日時スケールと互換性がありません
ユーザーがピボット グリッドで行を列ごと、またはその逆に変更したときに発生していました。この問題を回避するために、私はこのコードを試しました。
//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
ここでは関係のない別のエラーが発生しました。