Template talk:Graph:Lines

About this board

help needed with x axis

Jarekt (talkcontribs)

In the graph below

See or edit raw graph data.

is there a way to display dates on the x-axis. They could be just values of a "month" column corresponding to to the given row number.

Jarekt (talkcontribs)
Please ping me when replying.
RonnieV (talkcontribs)

@Jarekt, set 'X axis type' to 'time' and 'xField' to a column where you store dates like '2013-02', '2013-03',... See Template:Graph:Lines, under 'Template parameters' for more examples and options. RonnieV (talk) 16:17, 11 May 2023 (UTC)

Reply to "help needed with x axis"

Overflow in mobile view

IXTA9839 (talkcontribs)

I want to apologize ahead of time for my poor English. Now, big graph in mobile view is rendered outside the padding box. Is it able to add scrollbar if content overflows, like Template:Graph:Chart? Thank you,

Reply to "Overflow in mobile view"

Is it possible to avoid null values?

Theklan (talkcontribs)

I have a dataset where null values are stored as "0". I see that I can safely change them at JSON with "null", but the graph will still show them as "0". Is there any way to avoid those and just break the graph where no data exists?

Reply to "Is it possible to avoid null values?"

Having different scales for data

Theklan (talkcontribs)

Sometimes we have two different columns we want to compare (number of cases vs number of deaths) but one is way bigger than the other. Would it be possible to have different scales for one of them?

Jarekt (talkcontribs)

@Theklan: , I would use "| yScale = log" option, to switch to log scale

Reply to "Having different scales for data"

Margin when yZero is false and no minimum is specified

Dajasj (talkcontribs)

I have a template that I don't want to start at zero, but neither can I specify a minimum because it depends on the data. This graph automatically sets yMinimum to the minimum value in the query. However I would want some margin, because right now it looks this graph hits the bottom (which people automatically interpret as zero despite not being in the axis).

Reply to "Margin when yZero is false and no minimum is specified"

Add a tooltip when highlighting a line

PionCurieux (talkcontribs)

Looking at some graphs generated using this template, I realised that, if the used colours are quite similar, you can't know to which of the series a curve is associated with. . I suggest (but I clearly not able to) to add a simple tooltip when you highlight a curve with the mouse that shows the name of the series.

Reply to "Add a tooltip when highlighting a line"

Explanation switches to French

Metropolitan90 (talkcontribs)

In the Template parameters table here, all the descriptions are in English, except for "X axis scale clamp" which says, "Épingle sur l'échelle de l'axe X. Les courbes au delà de cette épingle seront cachées" (and similarly for "Y axis scale clamp"). I am pretty sure that we don't want to switch languages in the middle of an explanation like this. I don't know enough about this template to provide an English translation myself.

Reply to "Explanation switches to French"
Theklan (talkcontribs)

We have an example of limiting xMin for a year (1985) but, how can it be done for an exact date (1985-3-4)?

Reply to "xMin for exact dates"
Bouzinac (talkcontribs)

Hello, I've read Vega doc and see it is possible to have tooltips. But couldn't put them on with . Could anyone work on that ?

 "signals": [{"name": "rightwidth", "expr": "width + padding.right", "init":"400"},
     "name": "tooltip",
     "value": {},
     "on": [
       {"events": "group:mouseover", "update": "datum"},
       {"events": "group:mouseout",  "update": "{}"}


           "update": {
             "stroke": {"scale": "color", "field": "key"}, "x": {"scale": "xscale", "signal": "tooltip.category", "band": 0.5},
         "y": {"scale": "yscale", "signal": "tooltip.amount", "offset": -2},
         "text": {"signal": "tooltip.amount"},
Reply to "Tooltipping"
Bouzinac (talkcontribs)

Hello, is it possible to somewhere format the separators of numbers according to the locale of the wiki ? Likewise a {{formatnum}} with 10,000,000 in English and 10 000 000 in French, for instance, about the y axis ?