question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Style MarkLine label background

See original GitHub issue

What problem does this feature solve?

Better MarkLine label presentation.

What I want to achieve Best I can achieve with eCharts currently
image image

What does the proposed API look like?

markLine: {
    labelStyle: {
        color: '#f00',
        background: '#0f0',
        borderRadius: 2,
        padding: 4,
    }
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Bilgecommented, Sep 15, 2020

Thanks @narayn92, I was able to get results quite close to the reference image with the properties you provided.

What I want to achieve Best I can achieve with eCharts now
image image

But why aren’t they documented? Probably we should keep this issue open until they are documented so other people can find them.

1reaction
narayn92commented, Sep 15, 2020

@Bilge The above problem can be solved using the existing label properties which are not listed in the official documentation. You can see these properties in the source code. Attached screenshot for your reference.

image

Sample chart option:

var option = {
    xAxis: {
        data: ['A', 'B', 'C', 'D', 'E'],
    },
    yAxis: {},
    series: [{
        name: 'line',
        type: 'line',
        data: [1, 2, 3, 4, 5],
        markLine: {
            data: [{
            name: 'My label',
                xAxis: 'D',
                label: {
                    formatter: '{b}',
                    position: 'insideMiddleTop',
                    
                    color: '#fff',
                    textBorderColor: '#000',
                    textBorderWidth: 2,
                    
                    fontStyle: 'italic',
                    fontWeight: 'bold',
                    fontSize: 50,
                    fontFamily: 'Helvetica',
                    
                    // lineHeight: 25,
                    // width: 200,
                    // height: 200,
                    // tag: 'asdasdasdasdasd',
                    
                    backgroundColor: '#ff0000',
                    padding: 25,
                    borderColor: '#000',
                    borderWidth: 2,
                    borderRadius: 5,
                    
                    shadowColor: '#333333',
                    shadowBlur: 5,
                    shadowOffsetX: 5,
                    shadowOffsetY: 5,
                    
                    textShadowColor: '#0000ff',
                    textShadowBlur: 5,
                    textShadowOffsetX: 5,
                    textShadowOffsetY: 5,
                    
                }
            }]
        }
    }]
};

Read more comments on GitHub >

github_iconTop Results From Across the Web

Style MarkLine label background #13269 - apache/echarts
Better MarkLine label presentation. What I want to achieve Best I can achieve with eCharts currently What does the proposed API look like?...
Read more >
Format or styling label in apache echarts markLine
This labels has limit to improve deep custom design. ... design and other people will frustrate due incorrect style, color, position.
Read more >
Documentation - Apache ECharts
Background color of title, which is transparent by default. Color can be represented in RGB, for example 'rgb(128, 128, 128)' .
Read more >
echarts-markline - JSFiddle - Code Playground
Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle code editor.
Read more >
Styling - Chart.js
There are a number of options to allow styling an axis. ... backdropPadding, Padding, 2, Padding of label backdrop.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found