Hi,
I am populating a Stacked Column Chart with a date axis. However, I only want to display monday-friday so I only populate the chart with dates from my data set that are weekdays.
The chart is automatically adding blank spaces for the missing dates (weekends). When I changed it to a category axis it stopped stacking my bars and completely distorted the graph... as it created a new column for every single data point. Is there a way to hide the dates without data? Do I need to change my implementation in order to change the axis from date to category or a stacked bar chart?
relevant code:
public class DataViewModel
{
public string Category { get; set; }
public double? Phone { get; set; }
public double? ClaimsWork { get; set; }
public double? Unstaffed { get; set; }
public double? Outbound { get; set; }
public double? Meetings { get; set; }
public double? Personal { get; set; }
public DateTime Date { get; set; }
}
.Series(series =>
{
{
series.Column(model => model.Phone).Name("Phone").Stack(ChartStackType.Stack100).Color("#009bd7");
series.Column(model => model.ClaimsWork).Name("ClaimsWork").Stack(ChartStackType.Stack100).Color("#76b800");
series.Column(model => model.Unstaffed).Name("Unstaffed").Stack(ChartStackType.Stack100).Color("#d43851");
series.Column(model => model.Outbound).Name("Outbound").Stack(ChartStackType.Stack100).Color("#ffd600");
series.Column(model => model.Meetings).Name("Meetings").Stack(ChartStackType.Stack100).Color("#AF81C9");
series.Column(model => model.Personal).Name("Personal").Stack(ChartStackType.Stack100).Color("#ef4c00");
}
})
.CategoryAxis(axis => axis
.Labels(label => label
.Step(2)
)
.Name("label-axis")
.Categories(model => model.Date)
)
I am populating a Stacked Column Chart with a date axis. However, I only want to display monday-friday so I only populate the chart with dates from my data set that are weekdays.
The chart is automatically adding blank spaces for the missing dates (weekends). When I changed it to a category axis it stopped stacking my bars and completely distorted the graph... as it created a new column for every single data point. Is there a way to hide the dates without data? Do I need to change my implementation in order to change the axis from date to category or a stacked bar chart?
relevant code:
public class DataViewModel
{
public string Category { get; set; }
public double? Phone { get; set; }
public double? ClaimsWork { get; set; }
public double? Unstaffed { get; set; }
public double? Outbound { get; set; }
public double? Meetings { get; set; }
public double? Personal { get; set; }
public DateTime Date { get; set; }
}
.Series(series =>
{
{
series.Column(model => model.Phone).Name("Phone").Stack(ChartStackType.Stack100).Color("#009bd7");
series.Column(model => model.ClaimsWork).Name("ClaimsWork").Stack(ChartStackType.Stack100).Color("#76b800");
series.Column(model => model.Unstaffed).Name("Unstaffed").Stack(ChartStackType.Stack100).Color("#d43851");
series.Column(model => model.Outbound).Name("Outbound").Stack(ChartStackType.Stack100).Color("#ffd600");
series.Column(model => model.Meetings).Name("Meetings").Stack(ChartStackType.Stack100).Color("#AF81C9");
series.Column(model => model.Personal).Name("Personal").Stack(ChartStackType.Stack100).Color("#ef4c00");
}
})
.CategoryAxis(axis => axis
.Labels(label => label
.Step(2)
)
.Name("label-axis")
.Categories(model => model.Date)
)