Estoy creando un gráfico con las librerías de highchart
y highstock
.
La librería highchart
funciona perfecto y ya puedo hacer muchas modificaciones, pero al momento de usar la librería de highstock
genera un error y no puedo visualizarla:
Mi código es el siguiente:
namespace GraficaPrueba
{
public partial class Grafica : System.Web.UI.Page
{
SqlConnection cn;
SqlCommand cmd;
SqlDataReader dr;
protected void Page_Load(object sender, EventArgs e)
{
Grafica_Chart();
}
public byte[] selectAlarmas(int idPAciente)
{
try
{
cn = new SqlConnection("Data Source=JAVIERCASASUC;Initial Catalog=FUCS;Persist Security Info=True;User ID=pasante1;Password=sebastian1");
cn.Open();
Console.Write("conectado bien");
}
catch (Exception e)
{
Console.Write("no se conecto" + e);
}
byte[] Datos = null;
List<int> numeros = new List<int>();
try
{
cmd = new SqlCommand("Select ECG1 From dbo.Alarm where PatientiID=" + idPAciente + ";", cn);
dr = cmd.ExecuteReader();
}
catch (Exception e)
{
Console.Write("No se puede Consultar bien " + e.ToString());
}
if (dr.HasRows)
{
while (dr.Read())
{
if (!dr.IsDBNull(0))
{
Datos = (byte[])dr.GetValue(0);
for (int i = 0; i < Datos.Length; i++)
{
numeros.Add(Datos[i]);
}
}
}
}
return Datos;
}
protected void Grafica_Chart()
{
byte[] Datos = null;
List<int> graficoY = new List<int>();
Datos = selectAlarmas(104);
Object[] chartValues = new Object[Datos.Length];
for (int i = 0; i < Datos.Length; i++)
{
chartValues[i] = Datos[i];
}
// Declare the HighCharts object
// DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("StockChart")
DotNet.Highstock.Highstock chart = new DotNet.Highstock.Highstock("Chart")
.InitChart(new Chart
{
Type = ChartTypes.Line,
ZoomType = ZoomTypes.X,
Width = 900,
Height = 300
//DefaultSeriesType = ChartTypes.Line,
//ZoomType = ZoomTypes.X,
//SpacingRight = 20
})
.SetTitle(new Title
{
Text = ""
})
.SetPlotOptions(new PlotOptions {
Line = new PlotOptionsLine
{
EnableMouseTracking = false,
Animation = new Animation(true) { },
},
})
.SetXAxis(new XAxis
{
Labels = new XAxisLabels
{
Enabled = false
}
})
.SetYAxis(new YAxis
{
Title = new YAxisTitle
{
Text = ""
},
Labels = new YAxisLabels
{
Enabled = false
}
})
.SetSeries(new[]
{
new Series
{
//Name = "ECG1",
Data = new Data(chartValues) // Here we put the dbase data into the chart
},
});
chrtMyChart.Text = chart.ToHtmlString(); // Let's visualize the chart into the webform.
}
}
}
Y el error que sale al ejecutarlo por medio de un aspx es el siguiente
Unhandled exception at line 31, column 2 in http://localhost:52255/RevisCurva.aspx
0x800a01bd - Error en tiempo de ejecución de JavaScript: El objeto no acepta esta acción
¿Cuál puede ser la causa de este error?
Chart = new Highcharts.StockChart({
chart: { renderTo:'Chart_container', height: 300, type: 'line', width: 900, zoomType: 'x' },
plotOptions: { line: { animation: true, enableMouseTracking: false } },
title: { text: '' },
xAxis: { labels: { enabled: false } },
yAxis: { labels: { enabled: false }, title: { text: '' } },
series: [{ data: [125, 125, 125, 125, 125, 125, 125, 125, 125, 126, 127, 127, 129, 129, 130, 131, 132, 132, 133, 134, 135, 135, 135, 136, 136, 137, 137, 137, 138, 138, 138, 137, 137, 136, 136, 136, 135, 135, 133, 133, 133, 131, 130, 129, 129, 127, 126, 126, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 7, 1, 0, 16, 24, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 247, 248, 8, 8, 8, 24, 8, 8, 8, 8, 24, 8, 7, 247, 248, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 24, 24, 24, 40, 34, 130, 130, 131, 131, 130, 130, 130, 130, 130, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 127, 127, 128, 128, 128, 127, 127, 128, 129, 130, 131, 132, 134, 134, 134, 130, 125, 121, 117, 113, 112, 116, 120, 125, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 128, 128, 129, 128, 129, 129, 129, 128, 128, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 130, 129, 129, 129, 130, 130, 130, 130, 130, 130, 130, 130, 131, 130, 130, 130, 130, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 129, 128, 128, 128, 128, 128, 127, 127, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 125, 125, 125, 125, 125, 125, 125, 125, 125, 126, 127, 127, 129, 129, 130, 131, 132, 132, 133] }]
});
Este es el fragmento de codigo que dice que esta mal con el error