Question Assign value

kattungen

Member
Joined
Sep 8, 2019
Messages
8
Programming Experience
Beginner
Hello!

I am using A graphing tool for c# called Live Charts and would like to assign values to the y-axis based on an array I already have. So It would basically look like this:

C#:
  new LineSeries
                {
                    Title = "Species 1",
                    Values = new ChartValues<int>{1,2,3,4}
                }
Where Values should be assigned to an array called Info.

Also how do I make the x-axis be dependent to a variable. So that if I want it to be 100 units long I wont have to do it by hand?

C#:
 cartesianChart1.AxisX.Add(new Axis
            {
                Title = "Day",
Labels = new[] { "0","1", "2", "3", "4", "5", "6", "7", "8", "9", "10" }
            });

Thanks in advance!
 
I still get the same result

C#:
var values = new ChartValues<int>();
            var series = new LineSeries();
            values.Add(1);
            values.Add(2);
            values.Add(3);
            values.Add(4);
            
            series.Title = "Species 1";
            series.Values = values;
            cartesianChart1.Series = new SeriesCollection { };
 
15 posts on this nonsense. Pick up a book and learn. It's not like you don't have an excuse. MSDN is free and at your disposal, so use it to better understand what you're being shown. The failure here is your lack of understanding and willingness to learn, and you shouldn't be looking for people to do the work for you. That's not how it works around here.
 
Yes I am very helpful. I've enough profiles on various code forums to prove that. Thank you.

What you fail to understand is that we are not obliged to do the work for you. And while we can and will sit here all day correcting your mistakes, its' not actually going to benefit anyone, is it? And it certainly doesn't benefit your lack of understanding for the language. That's something you need to work on yourself. So on that note; you need to understand that there is no point in us explaining to you how something works over and over, which you don't and won't understand because you skipped class on the basic fundamentals of the language in play.

Further note, you've already been shown what you need to do, and you should show a little effort by indulging your curiosity and doing your own research into the advice you've already received.

Lastly, I never said you need to learn the whole language. I said you need to learn the fundamental principles of which surround the basics of the language; which thus gives you a better understanding with the above code. Lets remind you, this is also a learning forum and not a code writing service. ;)
 
I am using A graphing tool for c# called Live Charts
I just want to get this one thing working, not learn the entire language.
If you are using a graphing tool for C#, but don't want to learn C#, then I highly suggest picking a different graphing tool that will just let you manipulate the settings/data directly, or that uses some kind of markup.

Right now, it's like you deciding to pick up some wood, saw, hammer, measuring tape, nails, and varnish to make a bookshelf. You then go post a question on a woodworking forum asking how to build a bookshelf, but you are not interesting in learning any woodworking or wood finishing skills. If your goal is just to create a bookshelf, then get a ready to build bookshelf kit from Ikea or Target, where are the pieces are already pre-cut and finished and all you need to do is screw or nail some pieces together.
 
Back
Top Bottom