Skip to content

Custom X axis label for the first grid line #717

Open
@erkanisuf

Description

@erkanisuf

Hello i would like to add (string , possibly icon) where the red line is.
Screenshot 2021-08-03 at 10 51 29

My options are like this:

                                        xAxes: [{
							type: "time",
							position: "bottom",
							time: {
								displayFormats: {
									"year": "YYYY"
								},
								tooltipFormat: "MM-YYYY",
								unit: "year"
							},
							ticks: {
								offset: false,
								maxTicksLimit: 8,
								callback: (value, index) => {
									if (index === 0) {
										return "custom item"
									} else {
										return value
									}
								}
							}
						}]

I pushed a "fake data with year f.ex 1930" to the dataset and used ticks callback to change if the index is 0 with custom value but then it start to display all the years between like this: (which i don`t want).
Screenshot 2021-08-03 at 11 08 27

Then i changed the "fake data year to 2016" and it looks like this :
Screenshot 2021-08-03 at 11 20 23
I want something similar to this but the starting point should be as i showed in the first screenshot.
Would appreciate any tips how i can achieve that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions