This topic is locked

Line Chart Label by Month Index and Show Month Name

8/21/2023 4:40:40 AM
PHPRunner General questions
J
jacktonghk authorDevClub member

My table has an month index i.e. 1, 2, 3, 4 .... 12 with associated month name i.e. Jan, Feb, Mar, ..... Dec
In the lable field of the series tab, I can either select the index or name field. If label is index then the chart does not show month name but if lable is month name then the chart is not sort by month index, it sorts by month name's alphabetical order. How can I show the name and sort by index at the same time? Thanks.
Best regards,
Jack Tong

J
jacktonghk authorDevClub member 8/23/2023

I use 'custom' format in the 'view as' of my month index field and then add the following code to convert number to month name before display. It works.
switch ($value) {
case 1: $value = 'Jan';
break;
case 2: $value = 'Feb';
break;
case 3: $value = 'Mar';
break;
case 4: $value = 'Apr';
break;
case 5: $value = 'May';
break;
case 6: $value = 'Jun';
break;
case 7: $value = 'Jul';
break;
case 8: $value = 'Aug';
break;
case 9: $value = 'Sep';
break;
case 10: $value = 'Oct';
break;
case 11: $value = 'Nov';
break;
case 12: $value = 'Dec';
}