如何将hAxis(x轴)格式更改为HH:mm?

时间:2017-12-22 10:43:08

标签: google-analytics google-visualization google-analytics-api google-analytics-v4

请告诉我哪里出错了。

我的折线图如下所示:

enter image description here

目前的hAxis格式: HH(24小时)

目标: HH:MM,就像这样:

enter image description here

我在这里找到了可能的答案(Google line chart configuration),但只有标题奏效了:(

hAxis: {
    title: 'MY OWN LABEL GOES HERE',
    gridlines: {
        units: {hours: {format: ['HH:mm']}}
}

注意:我使用Google Analytics API

获取图表

1 个答案:

答案 0 :(得分:0)

尝试<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/RelativeLayout" android:layout_width="match_parent" android:layout_height="match_parent" android:scrollbars="vertical" android:theme="@style/AppTheme"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:id="@+id/NwApt" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="55dp" android:background="@color/colorS" android:padding="5dp" android:text="New Appointment" android:textColor="@color/PTextColour" android:textSize="18sp" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="@dimen/activity_horizontal_margin" android:orientation="vertical"> <EditText android:id="@+id/NEngNme" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="75dp" android:background="@android:drawable/editbox_background_normal" android:ems="10" android:hint="Engineer Name" android:inputType="textPersonName" /> <EditText android:id="@+id/NItm" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:drawable/editbox_background_normal" android:ems="10" android:hint="Item" android:inputType="textPersonName" /> <EditText android:id="@+id/NDate" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:drawable/editbox_background_normal" android:ems="10" android:hint="Date" android:inputType="date" /> <EditText android:id="@+id/NTime" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:drawable/editbox_background_normal" android:ems="10" android:hint="Time" android:inputType="time" /> <EditText android:id="@+id/NLoc" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:drawable/editbox_background_normal" android:ems="10" android:hint="Location" android:inputType="textPersonName" /> <EditText android:id="@+id/NTstNotes" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:background="@android:drawable/editbox_background_normal" android:ems="10" android:hint="Tester Notes" android:inputType="textMultiLine" /> <EditText android:id="@+id/NScdNotes" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:background="@android:drawable/editbox_background_normal" android:ems="10" android:hint="Scheduler Notes" android:inputType="textMultiLine" /> <CheckBox android:id="@+id/NntsChkBx" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:text="Show Notes at appointment" /> <CheckBox android:id="@+id/NaptChkBx" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Missed Appointment" /> <LinearLayout android:id="@+id/NButtons" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:weightSum="2"> <Button android:id="@+id/NSveNts" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="Save Notes" /> <Button android:id="@+id/NSndEml" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="Send Email" /> </LinearLayout> </LinearLayout> </RelativeLayout> </RelativeLayout> ...

hAxis.format