Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
In Bar Chart there is no XAxisFormat present in the widget property. As present situation the XAxis is TimeStamp. Where default format is YYYY:MM:DD HH:MM:SSS, as per the use case by the customer it should in the YY:MM:DD.
So this should be done in the Service or, there is work around for this ?
Thingworx version: 9.3
Thanks,
Shashi
Hi Shashi,
As a workaround you can use line chart widget instead.
After binding the data, setting the XAxisField, look for the XAxisDateFormatToken property and set it to sth like YY/MM/DD
https://www.ptc.com/en/support/article/CS341400
Hi @TonyZhang ,
Thanks for the response, but as per use case bar chart is needed, can't go for another alternative chart.
Thanks,
Shashi
Hi Shashi,
In that case you will probably need to create a custom service to transform your data,
in the custom service create a new infotable as the data source to feed the bar chart based on a new datashape (change DateTime field to type String for the XAxis of the Bar Chart)
You may use below snippets to loop through the existing infotable, transform the DateTime value to String with specified format and write each row to the new infotable.
//loop through infortable
.rows.toArray().forEach(row => {
});
//convert DateTime to String
dateFormat(row.timestamp, "yy-MM-dd");
Also you can post your enhancement ideas for Bar Chart Widget on below site.
https://community.ptc.com/t5/ThingWorx-Ideas/idb-p/thingworxideas
Hi @TonyZhang ,
Knew that it can be done from the Service side, The Question was, can it be done from the Mashup Widget Properties or is it a limitation of the Thingworx 9.3.
@slangley and @c_lowy ?
Thanks,
Shashi
Hi Shashi,
As far as I'm concerned, it appears to me that there's no such functionality to format XAxis display in Bar Chart widget (using properties).
And it's not limited to ThingWorx 9.3 but also no such functionality in other versions.
Please correct me if I'm wrong @slangley @c_lowy
BTW, could you please explain your use case and why you favor Bar Chart over Line Chart and why Line Chart is not an option?
Thanks,
Tony
Hi @TonyZhang ,
If the end customer/client needs an Bar chart, then can't be helped. They may have there reasons for it !
Thanks,
Shashi
Hi,
@paic @slangley @c_lowy @VladimirN @CarlesColl , can't Localization token can be set for the X-AxisFormat from the custom css ?
Thanks
Shashi.