- Home
- Forum
- ASP.NET MVC
- About the chart
About the chart
Hi,
I have two questions.
The version I'm using is Syncfusion.EJ2.MVC 5.18.4.0.44.
question 1
The horizontal axis of the chart is the date, and the label format is set to "M / d E".
It is displayed as 3/18 Thu, 3/19 Fri, 3/20 Sat ...
Is it possible to display the day of the week in Japanese?
Question 2
The horizontal axis of the chart is the date, and the label format is set to "M / d E".
Is it possible to color the label for each day of the week?
Specifically, I want to make it blue on Saturday and red on Sunday.
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
SM
Srihari Muthukaruppan
Syncfusion Team
March 24, 2021 11:39 AM UTC
Hi Pylori,
We can use axisLabelRender event in the chart to achieve your requirement. We have also prepared a sample for your reference in which we have modified the day of the week in Japanese language and also we have modified color of the label of the weekends to red as requested. This can also be customized based on your requirement. Please find the sample, code snippet, and screenshot below
Code Snippet:
|
// add your additional code here
@Html.EJS().Chart("container").AxisLabelRender("axislabelRender").ChartArea(area => area.Border(br => br.Color("transparent")))
// add your additional code here
<script>
var axislabelRender = function (args) {
if (args.axis.name == "primaryXAxis") {
if (args.text.indexOf('Mon') > -1) {
args.text = args.text.replace("Mon", "月曜");
} else if (args.text.indexOf('Tue') > -1) {
args.text = args.text.replace("Tue", "火曜日");
} else if (args.text.indexOf('Wed') > -1) {
args.text = args.text.replace("Wed", "水曜日");
} else if (args.text.indexOf('Thu') > -1) {
args.text = args.text.replace("Thu", "木曜日");
} else if (args.text.indexOf('Fri') > -1) {
args.text = args.text.replace("Fri", "金曜日");
} else if (args.text.indexOf('Sat') > -1) {
args.text = args.text.replace("Sat", "土曜日");
args.labelStyle.color = "red";
} else if (args.text.indexOf('Sun') > -1) {
args.text = args.text.replace("Sun", "日曜日");
args.labelStyle.color = "red";
}
}
}
</script>
// add your additional code here
|
Screenshot:
Let us know if you have any concerns.
Regards,
Srihari M
Marked as answer
PY
Pylori
March 24, 2021 12:09 PM UTC
Hi,
Thank you for the quick reply.
Thanks to you, I was able to solve the problem.
Regards,
Pylori
SM
Srihari Muthukaruppan
Syncfusion Team
March 25, 2021 07:08 AM UTC
Hi Pylori,
Most welcome. Kindly get in touch with us, if you require further assistance. We are always happy in assisting you.
Thanks,
Srihari
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
- Marked answer
-
PY Pylori
- Mar 23, 2021 02:54 PM UTC
- Mar 25, 2021 07:08 AM UTC