### Instruction:
Create a Node.js script that uses the Twitter API to fetch the latest tweets from a specified user's timeline, analyzes the sentiment of each tweet using a natural language processing library, and displays the results in a graphical format (e.g., pie chart or bar graph).

### Response:

To create a Node.js script that fetches the latest tweets from a specified user's timeline, analyzes their sentiment using a natural language processing library, and displays the results in a graphical format, follow these steps:

1. Install the required packages:
- Twitter API client for Node.js: `npm install twitter-lite`
- Sentiment analysis library: `npm install sentiment`
- Chart generation library: `npm install chartjs-node-canvas`

2. Create a new file called `twitter_sentiment_analysis.js` and add the following code:

```javascript
const Twitter = require('twitter-lite');
const Sentiment = require('sentiment');
const { ChartJSNodeCanvas } = require('chartjs-node-canvas');

// Replace with your own Twitter API credentials
const client = new Twitter({
  consumer_key: 'your_consumer_key',
  consumer_secret: 'your_consumer_secret',
  access_token_key: 'your_access_token_key',
  access_token_secret: 'your_access_token_secret'
});

const sentimentAnalyzer = new Sentiment();

async function getTweets(username) {
  try {
    const params = {
      screen_name: username,
      count: 200 // Fetch up to 200 tweets (maximum allowed by the API)
    };

    const data = await client.get('statuses/user_timeline', params);
    return data;
  } catch (error) {
    console.error(error);
  }
}

function analyzeSentiments(tweets) {
  let positive = 0;
  let negative = 0;
  let neutral = 0;

  tweets.forEach(tweet => {
    const result = sentimentAnalyzer.analyze(tweet.text);

    if (result.score > 0) {
      positive++;
    } else if (result.score < 0) {
      negative++;
    } else {
      neutral++;
    }
  });

  return { positive, negative, neutral };
}

async function generateChart(sentiments) {
  const chartJSNodeCanvas = new ChartJSNodeCanvas({ width: 600, height: 400 });

  const configuration = {
    type: 'pie',
    data: {
      labels: ['Positive', 'Negative', 'Neutral'],
      datasets: [
        {
          data: [sentiments.positive, sentiments.negative, sentiments.neutral],
          backgroundColor: ['#4caf50', '#f44336', '#2196f3']
        }
      ]
    },
    options: {
      title: {
        display: true,
        text: 'Sentiment Analysis of Tweets'
      }
    }
  };

  const imageBuffer = await chartJSNodeCanvas.renderToBuffer(configuration);
  require('fs').writeFileSync('chart.png', imageBuffer);
}

async function main() {
  const username = 'example_username'; // Replace with the desired Twitter username
  const tweets = await getTweets(username);
  const sentiments = analyzeSentiments(tweets);

  console.log(`Positive tweets: ${sentiments.positive}`);
  console.log(`Negative tweets: ${sentiments.negative}`);
  console.log(`Neutral tweets: ${sentiments.neutral}`);

  await generateChart(sentiments);
  console.log('Generated chart as "chart.png"');
}

main();
```

3. Replace `'your_consumer_key'`, `'your_consumer_secret'`, `'your_access_token_key'`, and `'your_access_token_secret'` with your own Twitter API credentials.

4. Replace `'example_username'` with the desired Twitter username whose tweets you want to analyze.

5. Run the script using Node.js:

```bash
node twitter_sentiment_analysis.js
```

The script will fetch the latest tweets from the specified user's timeline, analyze their sentiment, and generate a pie chart displaying the results in a file called `chart.png`.