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 792225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T21:57:34+00:00 2026-05-14T21:57:34+00:00

I have the datalist = 62, 76, 80, 72, 71, 75, 77 that i

  • 0

I have the datalist = 62, 76, 80, 72, 71, 75, 77 that i want to present as a 2D line drawed point to point. In my Wpf application i have a canvas with the height: 173 and width: 455.

How do i go about it and draw a line by my datalist and use almost the whole height of the canvas? as it is now the data is just represented on a line at the bottom at the canvas, not using (and therefor giving a bad representation of the data) whole heigh of the canvas.
It would also be nice to place it in the center of the box too…

  • 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-05-14T21:57:34+00:00Added an answer on May 14, 2026 at 9:57 pm

    You’ll need to transform your datalist to represent the whole height of the canvas. There are two obvious ways of doing this:

    1) Divide the height of the canvas by the largest value in your datalist. Multiply all the values in the datalist by this and bind to these new datapoints.

    2) Add the line as you are now and then apply a scale transform of the multiplier from option 1.

    Either way you shouldn’t need to centre now since the whole canvas will be used up.


    I see on review you actually say “almost the whole height of the canvas” and the Adrian’s comment below is correct in that I didn’t think through the lower bounds. Here’s some better pseudo-code

    int border = 20; //How much of the canvas you *don't* want to use
    int graphHeight = Canvas.Height - border;
    int maxValue = DataList.GetMaxValue();
    int minValue = DataList.GetMinValue();
    
    double multiplier = graphHeight / (maxValue - minValue);
    
    foreach(int value in DataList)
    {
        int distanceFromBottom = value - minValue;
        double proportionalValue = distanceFromBottom * multiplier;
        double newValue = proportionalValue  + (border/2) // move it up to the middle of the canvas
    }
    

    Store the newValues in a new DataList and bind to that.

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

Sidebar

Related Questions

I have a threaded server application that stores List<Item> dataList . There is a
Kinda hard to explain, but i'll try. I have a datalist that is populated
I have a datalist inside a usercontrol that gets loaded into a page where
I have a datalist being generated with ASP, but unfortunately the jQuery script that
if I have a datalist with textbox and a button inside and i want
I have an ArrayList in my Servlet code. Now, I want to show that
I have a DataList inside a DataList that causes my page to lose the
I have a datalist that receives values from a MySQL database. This datalist can
I have a datalist inside that I am using a checkbox, I have 1
I have a datalist i want to programmatically run some checks and then change

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.