I'm probably doing something wrong but using the latest package versions, I'm not getting any data on the chart and the x axis just shows the time for today.
`
// Generate the chart
Chart chart = new Chart();
chart.Type = Enums.ChartType.Line;
// Generate the data
var dataSetData = new List<LineScatterData>();
foreach (var item in returnList)
{
dataSetData.Add(new LineScatterData()
{
X = item.StartedAt.ToString("dd-MM-yyyy"),
Y = item.TimeTakenInSeconds.ToString()
});
}
// Add the data
Data data = new Data();
data.Datasets = new List<Dataset>();
data.Datasets.Add(new LineScatterDataset()
{
Label = "Time Taken In Seconds",
Data = dataSetData
});
chart.Data = data;
// Create the axis
CartesianLinearScale xAxis = new CartesianLinearScale()
{
Type = "time",
Title = new Title() { Text = new List<string>() { "Created Date" } }
};
CartesianLinearScale yAxis = new CartesianLinearScale()
{
Type = "linear",
Title = new Title() { Text = new List<string>() { "Time Taken" } }
};
// Add the axis
chart.Options = new ChartJSCore.Models.Options();
chart.Options.Scales = new Dictionary<string, Scale>();
chart.Options.Scales.Add("x", xAxis);
chart.Options.Scales.Add("y", yAxis);
chart.Options.Layout = new Layout();
chart.Options.Layout.Padding = new Padding() { PaddingInt = 0 };
// Return
return chart;`
Hi there,
I'm probably doing something wrong but using the latest package versions, I'm not getting any data on the chart and the x axis just shows the time for today.
Scripts: