How to add a string to ChartValues in LiveChart in c#










0















I have this situation:



I what to create this chart https://lvcharts.net/App/examples/v1/wf/Stacked%20Area from an info of datagridview, that is not the problem, the problem is that i want to create the chart just using 2 variables, date and value.



Now that i had already charge the datagridview with the info, i proceed to create the chart on this way:



private void crearGrafica5()

int con = 0;
foreach (DataGridViewRow row in dataGridView3.Rows)

con++;


if (con > 0)

Func<ChartPoint, string> labelPoint = chartPoint =>
string.Format("0 (1:P)", chartPoint.Y, chartPoint.Participation);

int conn = 0;
string utilidades = new string[dataGridView3.RowCount];
string fechas = new string[dataGridView3.RowCount];

cartesianChart2.Series.Clear();
cartesianChart2.Series = new SeriesCollection ;

foreach (DataGridViewRow row in dataGridView3.Rows)

utilidades[conn] = row.Cells[3].Value.ToString();
fechas[conn] = row.Cells[3].Value.ToString();
conn++;


string values_grafica = "new ChartValues<DateTimePoint> ";

for(int i=0;i<utilidades.Length;i++)

if (i == 0)

values_grafica += "new DateTimePoint(new System.DateTime(" + fechas[i] + "," + utilidades + ")";

else

values_grafica += ",new DateTimePoint(new System.DateTime(" + fechas[i] + "," + utilidades + ")";



values_grafica = "";

ChartValues values_gra = new ChartValues<>;

if (conn < 10)

cartesianChart2.Series.Add
(
new StackedAreaSeries

Title = row.Cells[0].Value.ToString(),
Values = /////this is my problem,
LineSmoothness = 0

);

conn++;


pieChart1.LegendLocation = LegendLocation.Bottom;
button1.Enabled = true;

else

button1.Enabled = false;
pieChart1.Series.Clear();




But i don't know how can i add the values_grafica string to the values of the chart.



Please any help?










share|improve this question




























    0















    I have this situation:



    I what to create this chart https://lvcharts.net/App/examples/v1/wf/Stacked%20Area from an info of datagridview, that is not the problem, the problem is that i want to create the chart just using 2 variables, date and value.



    Now that i had already charge the datagridview with the info, i proceed to create the chart on this way:



    private void crearGrafica5()

    int con = 0;
    foreach (DataGridViewRow row in dataGridView3.Rows)

    con++;


    if (con > 0)

    Func<ChartPoint, string> labelPoint = chartPoint =>
    string.Format("0 (1:P)", chartPoint.Y, chartPoint.Participation);

    int conn = 0;
    string utilidades = new string[dataGridView3.RowCount];
    string fechas = new string[dataGridView3.RowCount];

    cartesianChart2.Series.Clear();
    cartesianChart2.Series = new SeriesCollection ;

    foreach (DataGridViewRow row in dataGridView3.Rows)

    utilidades[conn] = row.Cells[3].Value.ToString();
    fechas[conn] = row.Cells[3].Value.ToString();
    conn++;


    string values_grafica = "new ChartValues<DateTimePoint> ";

    for(int i=0;i<utilidades.Length;i++)

    if (i == 0)

    values_grafica += "new DateTimePoint(new System.DateTime(" + fechas[i] + "," + utilidades + ")";

    else

    values_grafica += ",new DateTimePoint(new System.DateTime(" + fechas[i] + "," + utilidades + ")";



    values_grafica = "";

    ChartValues values_gra = new ChartValues<>;

    if (conn < 10)

    cartesianChart2.Series.Add
    (
    new StackedAreaSeries

    Title = row.Cells[0].Value.ToString(),
    Values = /////this is my problem,
    LineSmoothness = 0

    );

    conn++;


    pieChart1.LegendLocation = LegendLocation.Bottom;
    button1.Enabled = true;

    else

    button1.Enabled = false;
    pieChart1.Series.Clear();




    But i don't know how can i add the values_grafica string to the values of the chart.



    Please any help?










    share|improve this question


























      0












      0








      0








      I have this situation:



      I what to create this chart https://lvcharts.net/App/examples/v1/wf/Stacked%20Area from an info of datagridview, that is not the problem, the problem is that i want to create the chart just using 2 variables, date and value.



      Now that i had already charge the datagridview with the info, i proceed to create the chart on this way:



      private void crearGrafica5()

      int con = 0;
      foreach (DataGridViewRow row in dataGridView3.Rows)

      con++;


      if (con > 0)

      Func<ChartPoint, string> labelPoint = chartPoint =>
      string.Format("0 (1:P)", chartPoint.Y, chartPoint.Participation);

      int conn = 0;
      string utilidades = new string[dataGridView3.RowCount];
      string fechas = new string[dataGridView3.RowCount];

      cartesianChart2.Series.Clear();
      cartesianChart2.Series = new SeriesCollection ;

      foreach (DataGridViewRow row in dataGridView3.Rows)

      utilidades[conn] = row.Cells[3].Value.ToString();
      fechas[conn] = row.Cells[3].Value.ToString();
      conn++;


      string values_grafica = "new ChartValues<DateTimePoint> ";

      for(int i=0;i<utilidades.Length;i++)

      if (i == 0)

      values_grafica += "new DateTimePoint(new System.DateTime(" + fechas[i] + "," + utilidades + ")";

      else

      values_grafica += ",new DateTimePoint(new System.DateTime(" + fechas[i] + "," + utilidades + ")";



      values_grafica = "";

      ChartValues values_gra = new ChartValues<>;

      if (conn < 10)

      cartesianChart2.Series.Add
      (
      new StackedAreaSeries

      Title = row.Cells[0].Value.ToString(),
      Values = /////this is my problem,
      LineSmoothness = 0

      );

      conn++;


      pieChart1.LegendLocation = LegendLocation.Bottom;
      button1.Enabled = true;

      else

      button1.Enabled = false;
      pieChart1.Series.Clear();




      But i don't know how can i add the values_grafica string to the values of the chart.



      Please any help?










      share|improve this question
















      I have this situation:



      I what to create this chart https://lvcharts.net/App/examples/v1/wf/Stacked%20Area from an info of datagridview, that is not the problem, the problem is that i want to create the chart just using 2 variables, date and value.



      Now that i had already charge the datagridview with the info, i proceed to create the chart on this way:



      private void crearGrafica5()

      int con = 0;
      foreach (DataGridViewRow row in dataGridView3.Rows)

      con++;


      if (con > 0)

      Func<ChartPoint, string> labelPoint = chartPoint =>
      string.Format("0 (1:P)", chartPoint.Y, chartPoint.Participation);

      int conn = 0;
      string utilidades = new string[dataGridView3.RowCount];
      string fechas = new string[dataGridView3.RowCount];

      cartesianChart2.Series.Clear();
      cartesianChart2.Series = new SeriesCollection ;

      foreach (DataGridViewRow row in dataGridView3.Rows)

      utilidades[conn] = row.Cells[3].Value.ToString();
      fechas[conn] = row.Cells[3].Value.ToString();
      conn++;


      string values_grafica = "new ChartValues<DateTimePoint> ";

      for(int i=0;i<utilidades.Length;i++)

      if (i == 0)

      values_grafica += "new DateTimePoint(new System.DateTime(" + fechas[i] + "," + utilidades + ")";

      else

      values_grafica += ",new DateTimePoint(new System.DateTime(" + fechas[i] + "," + utilidades + ")";



      values_grafica = "";

      ChartValues values_gra = new ChartValues<>;

      if (conn < 10)

      cartesianChart2.Series.Add
      (
      new StackedAreaSeries

      Title = row.Cells[0].Value.ToString(),
      Values = /////this is my problem,
      LineSmoothness = 0

      );

      conn++;


      pieChart1.LegendLocation = LegendLocation.Bottom;
      button1.Enabled = true;

      else

      button1.Enabled = false;
      pieChart1.Series.Clear();




      But i don't know how can i add the values_grafica string to the values of the chart.



      Please any help?







      c# livecharts






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 13 '18 at 22:00







      Carlos Jaramillo Corrales

















      asked Nov 13 '18 at 20:56









      Carlos Jaramillo CorralesCarlos Jaramillo Corrales

      208




      208






















          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53289371%2fhow-to-add-a-string-to-chartvalues-in-livechart-in-c-sharp%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53289371%2fhow-to-add-a-string-to-chartvalues-in-livechart-in-c-sharp%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          How to read a connectionString WITH PROVIDER in .NET Core?

          Node.js Script on GitHub Pages or Amazon S3

          Museum of Modern and Contemporary Art of Trento and Rovereto