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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:26:42+00:00 2026-05-27T03:26:42+00:00

I´ve got the following code: private void LoadPieChartData() { LinkedList<String> kostenstellen = rep.GetKostenstellen(); for

  • 0

I´ve got the following code:

private void LoadPieChartData()
{
    LinkedList<String> kostenstellen = rep.GetKostenstellen();

    for (int i = 0; i < kostenstellen.Count; i++)
    {
        ((ColumnSeries)PieChart.Series[i]).ItemsSource = new KeyValuePair<string, double>[]{
           new KeyValuePair<string,double>(kostenstellen.ElementAt(i), i+1)
           };
        }
    }
}

My Xaml looks like this:

<DVC:Chart HorizontalAlignment="Left" Margin="625,44,0,0" Name="PieChart" VerticalAlignment="Top" Height="276" Width="256" > 
    <DVC:Chart.Series>
        <DVC:PieSeries Title="FirstPiece" ItemsSource="{Binding LoadPieChartData}" IndependentValueBinding="{Binding Path=Key}" DependentValueBinding="{Binding Path=Value}" />
        <DVC:PieSeries Title="SecondPiece" ItemsSource="{Binding LoadPieChartData}" IndependentValueBinding="{Binding Path=Key}" DependentValueBinding="{Binding Path=Value}" />
    </DVC:Chart.Series>
</DVC:Chart>

My problem is, that the i in the for-loop can be raise up to about 20. So, I would need about 20 PieSeries, to create them dynamic isn´t possible as I know.
How can I manage that?

  • 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-27T03:26:43+00:00Added an answer on May 27, 2026 at 3:26 am

    If what you are trying to do is simply display a pie chart with several segments, all you have to do is bind a collection to a single PieSeries‘s ItemsSource property:

    <DVC:Chart Name="PieChart">
        <DVC:Chart.Series>
            <DVC:PieSeries ItemsSource="{Binding LoadPieChartData}" 
                           IndependentValueBinding="{Binding Path=Key}" 
                           DependentValueBinding="{Binding Path=Value}" />
        </DVC:Chart.Series>
    </DVC:Chart>
    

    I used the following property:

    public IEnumerable<KeyValuePair<string,int>> LoadPieChartData
    {
        get
        {
            for (int i = 0; i < 20; i++)
            {
                yield return new KeyValuePair<string, int>("Item " + i, i);
            }
        }
    }
    

    And I get the following chart:

    enter image description here

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

Sidebar

Related Questions

I got the following code: string path = Environment.CurrentDirectory; private void button1_Click(object sender, EventArgs
I've got the following code: Public Delegate Sub SetStatusBarTextDelegate(ByVal StatusText As String) Private Sub
I got the following code to run the application at windows startup: private void
Let's assume we've got the following Java code: public class Maintainer { private Map<Enum,
I got the following code: char buffer[2047]; int charsRead; do { if(fscanf(file, %2047[^\n]%n%*c, buffer,
I have got the following code #include <iostream> #include <string> template <typename T> class
I have following code: private void fileSystemWatcher_Changed(object sender, System.IO.FileSystemEventArgs e) { System.Diagnostics.Process execute =
i have executed the following code public class Activity_Threads_Handler extends Activity { private int
I got the following code: import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class Sha1{ private static
I am work with SharpPcap library. I have following code: private void button1_Click(object sender,

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.