New-UDChart Data Formatting

Is there a way to stop the chart from converting a datetime input to milliseconds? I’ve tried following examples on the ChartJS website as well as stuff from the following StackOverflow link but I can’t get it working. https://stackoverflow.com/questions/39859066/chartjs-shows-date-but-not-time-when-displaying-labels-in-time-axis

As an example, on the x-axis I have the “Time” property (datetime) but it is being displayed as /Date(1550755800000)/

Thanks in advance for any help/guidance!

1 Like

Having the same issue

I’m also having this issue. Did you ultimately figure out a solution?

Hey @nole @theabraxas and @robertoabraham I know this post is old then had a recent update…I have made charts using a date and values. I have always provided my dates in yyyy-MM-dd format from an SQL query, and not had any issues displaying. If any of you guys can post a bit more code of what you are trying to do, I am more than happy to pitch in and try to solve this riddle. Thanks :slight_smile:

P.S Sorry I stand corrected, I did have a date display issue so I had to use this in my SQL
convert(varchar,LoggedDate,103) LoggedDate

Try something like this:

xAxes = @(
	@{
		display = $true
		type = 'time'
		time = @{
			unit = 'week'
			unitStepSize = 1
			displayFormats = @{
				week = 'DD/MM/YYYY'
			}
		}
	}
)

Thanks so much @OpsEng and @psDevUK ! This did the trick for me:

-Options @{  
                    scales = @{
                        xAxes = @(
                            @{
                                display = $true
                                type    = 'time'
                                time    = @{
                                    unit = 'hour'
                                }
                            }
                        )
                    }
               }

Thanks again!