Ticket T401774
Visible to All Users

How to format numbers displayed by different web dashboard items in a custom manner

created 9 years ago

Hi,

I'm tyring to format a number in the application based dashboard designer .
I'm only allowed to format it in a certain predefined way (currency, general, scientific, percent and so on).

Is there a way to format freely? Or is it a way to use the cube format?

I have a field that contains amount of hours. I would like to display the number as 56 hours and not just 56 like it is now.

Regards,
Adam

Show previous comments (1)

    I would love to see a sample project.

    Preferably a web viewer.

    DevExpress Support Team 9 years ago

      Hi Adam,
      Would you please clarify what dashboard items (grid, chart, pivot, etc.) and what their parts (cells, axis labels, etc.) you wish to change? Different widgets and elements have different methods.

        I currently use it for cards, gauges, grids and charts.

        Thanks in advance :)

        Answers approved by DevExpress Support

        created 9 years ago (modified 7 years ago)

        I have attached a sample project demonstrating how to format values manually by configuring Underlying Widgets. This project works with Grid, Chart and Gauge items. I am afraid we do not provide a public Card Item widget that can be used in a similar manner. Thus, it is impossible to format card values manually.

        JavaScript
        function UpdateItems(s, e) { if (e.ItemName.indexOf('gauge') >= 0) { var gauges = e.GetWidget(); $.each(gauges, function (_, gauge) { gauge.option('scale.label.customizeText', function (event) { return FormatValue(event.value); }); gauge.option('indicator.text.value', FormatValue(gauge.option('subvalues[0]') - gauge.option('value'))); }); } if (e.ItemName.indexOf('grid') >= 0) { var grid = e.GetWidget(); grid.columnOption(2, 'cellTemplate', function (container, options) { container.text(FormatValue(options.value)); }); } if (e.ItemName.indexOf('chart') >= 0) { var chart = e.GetWidget(); var chartOptions = chart.option(); $.each(chartOptions.series, function (_, series) { if (series.label != undefined) //ignore internal empty series { series.label.customizeText = function (point) { return FormatValue(this.value); } } }); chartOptions.valueAxis[0].label.customizeText = function () { return FormatValue(this.value); }; chart.option(chartOptions); } } function FormatValue(value) { return (value / 1000).toFixed(2) + '*' }
          Comments (2)

            That's sad.

            When will you be able to implement cube formatting?

            DevExpress Support Team 9 years ago

              We realize that this is an important task,  but I cannot provide you with any estimation regarding this functionality implementation, or promise that it will be implemented soon. We have not established the release date for this feature.

              Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

              Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.