Hola estoy implementando un gráfico de tipo candlestick que requiere datos en formato json. Mi api devuelte datos asi:
[{"Interval":"2024-06-06 18:15:00","Opening":-2.0,"Maximum":0.0,"Minimum":-3.0,"Closing":-1.0},
{"Interval":"2024-06-06 19:50:00","Opening":-10.0,"Maximum":-8.0,"Minimum":-12.0,"Closing":-12.0},
{"Interval":"2024-06-06 19:55:00","Opening":-13.0,"Maximum":-10.0,"Minimum":-16.0,"Closing":-13.0},
{"Interval":"2024-06-06 20:00:00","Opening":-12.0,"Maximum":-12.0,"Minimum":-15.0,"Closing":-14.0},
{"Interval":"2024-06-06 20:05:00","Opening":-13.0,"Maximum":-8.0,"Minimum":-14.0,"Closing":-8.0}]
Uso esto en mi controlador mvc:
@ViewBag.Data = jsondatos;
y esta linea en mi vista:
[email protected]
Mi grafico aparece en blanco. Examinando el html resultante de la vista los datos aparecen así:
anychart.data=[{"Interval":"2024-06-06 18:15:00","Opening":-2.0,"Maximum":0.0,"Minimum":-3.0,"Closing":-1.0},
{"Interval":"2024-06-06 18:20:00","Opening":0.0,"Maximum":1.0,"Minimum":-3.0,"Closing":-1.0},
{"Interval":"2024-06-06 18:25:00","Opening":0.0,"Maximum":4.0,"Minimum":-1.0,"Closing":0.0},
{"Interval":"2024-06-06 18:30:00","Opening":1.0,"Maximum":1.0,"Minimum":-2.0,"Closing":0.0},
{"Interval":"2024-06-06 18:35:00","Opening":-1.0,"Maximum":-1.0,"Minimum":-4.0,"Closing":-3.0}]
Estoy usando C# MVC Que me falta para evitar esa transformación de datos?