Label in Date Format on Y Axis

  • Last update:March 16, 2025
  • Overview

    Problem

    In some scenarios, as the values on the Y axis of a chart is the date data from a dataset,  the axis labels of the Y axis also need to be modified to the date format. Take a line chart as an example. The following figure shows the effect.

     image 1.png

    If you only set the format of axis labels in the chart to Date under Style > Axis > Y Axis > Format,

    image 2.png

     the chart data cannot be displayed properly in the front-end preview, as shown in the following figure.

     1615884873207997.png

    So how to set the format of axis labels to date format while ensuring  that the chart displays the data properly? This document will introduce the solution in detail.

    Solution

    1. Drag the date data corresponding to the Y axis in the dataset into a cell and convert the data to milliseconds by using the formula DATETONUMBER(date).

    2. Bind   the cell data converted to milliseconds to the chart.

    3. Finally, set Axis Label Format of the Y axis of the chart to Date.

    Example

    Data Preparation

    Create a general report, create a built-in dataset, and modify the dataset name to ds1, as shown in the following figure.

    The Process field in the dataset is the string type, corresponding to the X axis category. The Scheduling field is the date type, corresponding to the Y axis value.

    image 3.png

    Chart Insertion

    Merge  required cells, select the merged cell A1, click the Insert Chart icon, insert Line Chart, and click OK, as shown in the following figure.

    image 4.png

    Converting Date to Milliseconds

    Drag the Process and Scheduling fields from the built-in dataset into cells A22 and cell B22 respectively, select cell D22, click the Insert Formula icon, and insert the formula DATETONUMBER(B22), as shown in the following figure.

    image 5.png

    Data Binding

    On the line chart attribute panel, choose Cell Element > Data, select Cell Data from the drop-down list of Data Source, set the category name to cell A22, add a series with an empty series name, and set the value to cell D22, as shown in the following figure.

    image 6.png

    Style Setting

    Title

    On the line chart attribute panel, choose Cell Element > Style > Title, select Show Title, and set the title content to Semiconductor Process Scheduling, as shown in the following figure.

    image 7.png

    Axis

    On the line chart attribute panel, choose Cell Element > Style > Axis > Y Axis, tick Custom Minimum Value in Value Definition, set the value of Minimum to1262275200000, which means the minimum axis label is 2010-01-01, and set Axis Label Format to Date, as shown in the following figure.

    iconNote:
    The purpose of setting the minimum value is to set a reasonable range for the values on the Y axis , making the  line trend in the chart more obvious. You can use the DATETONUMBER(date) formula to convert the date as needed.

    image 8.png

    Prompt

    On the line chart attribute panel, choose Cell Element > Style > Prompt, select Use Tooltip, select Category Name, Series, and Value, and set Format of Value to Date, as shown in the following figure.

    image 11.png

    Cell Hiding

    Select the 22nd row, right-click and select Hide, the cell data will not be displayed on the front end, as shown in the following figure.

    image 12.png

    Effect Display

    PC

    Save the report, and click Pagination Preview. The following figure shows the preview effect.

    iconNote:
    The Y axis label value is set to 2010-01-01, but the chart scale will automatically display the content from an appropriate value , so the minimum value displayed is not the set minimum value.

    image 13.png

    Mobile Terminal

    微信图片_20250316112652.jpg

    Template Download

    Click to download the template Label in Date Format on Y Axis.cpt.

    Attachment List


    Theme: Chart
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    9s后關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy