Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9055731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:01:37+00:00 2026-06-16T14:01:37+00:00

I need to add a vertical line and a text on my Line chart

  • 0

I need to add a vertical line and a text on my Line chart near to a specified point on chart (specified by data, not coordinates). I tried to use CompositeSprites, but it doesn’t show on screen completely. I’m new to ExtJS drawing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T14:01:38+00:00Added an answer on June 16, 2026 at 2:01 pm

    You should put the logic that adds the vertical line inside of the chart’s refresh event listener, that way, if the data changes the line position will be updated to reflect the new data.

    Here’s an example of how you could do it, assuming you can get a reference to the chart container (e.g. “myPanel”):

    var myChart = myPanel.down('chart'),
    
    myChart.on('refresh', function(myChart) {
    
        // First, get a reference to the record that you want to position your 
        // vertical line at. I used a "findRecord" call below but you can use 
        // any of the datastore query methods to locate the record based on 
        // some logic: findBy (returns index #), getAt, getById, query, queryBy
        var myRecord = myChart.store.findRecord(/*[someField]*/, /*[someValue]*/),
    
        // a reference to the series (line) on the chart that shows the record
        mySeries = myChart.series.first(), 
    
        // get the chart point that represents the data
        myPoint = Ext.each(mySeries.items, function(point) {
            return myRecord.id === point.storeItem.id;
        }),
    
        // the horizontal position of the point
        xCoord = point.point[0],
    
        // check for any previously drawn vertical line
        myLine = myChart.surface.items.findBy(function(item) {
            item.id === 'vert'
        });
    
        // if there is no previously drawn line add it to the "surface"
        if (!myLine) {
    
            myChart.surface.add({
                id: 'vert', // an id so that we can find it again later
                type: 'rect',
                width: 4,
                height: myChart.surface.height, // the same height as the chart
                fill: 'black',
                opacity: 0.5, // some transparency might be good
                x: xCoord,
                y: 0 // start the line at the top of the chart
            });
    
        // if we already had a line just reposition it's x coordinate            
        } else {
    
            myLine.setAttributes({
                translate: {
                    x: xCoord,
                    y: 0
                }
    
            // I think the chart gets drawn right after the refresh event so 
            // this can be false, I haven't tested it though
            }, false);
    
        }
    });
    

    If you are using the MVC pattern your event handler would look a little different (you wouldn’t use myChart.on()).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tabbox with several vertical tabs. I need to add labels between some
i need to create a white separator line with java. I need to add
Here is the markup. I want to add a vertical line between the two
I need to add views to a vertical Linearlayout at bottom programmatically. (Yes we
As part of a SMS app I am making, I need to add text
I have a View to that I need to add some text. The used
I need add Auto complete on apex Tabular Form. there is a column as
I need add a new user group for mediawiki. The new group has more
I can't access a element with its href. Like this example, i need add
Hї! I have wrote test for my application. I need add item to database

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.