How to create many series












0














Create an object in the class "Series ema = new Series("ema");"
With the button "indicator_Click" download modal dialog.
In the window using the "ComboBox" select options: dig.type, dig.period.



Series ema = new Series("ema");
**********************************************
private void indicator_Click(object sender, EventArgs e)
{
ModalDialogBox dig = new ModalDialogBox();
{
if (dig.ShowDialog() == DialogResult.OK)
{
string formulaName = dig.type;
FinancialFormula formula = (FinancialFormula)Enum.Parse(typeof(FinancialFormula), formulaName, true);
chart1.Series.Add(ema);
chart1.DataManipulator.FinancialFormula(formula, dig.period, "price", "ema");
chart1.Series["ema"].Color = Color.Red;
chart1.Series["ema"].ChartType = SeriesChartType.Line;
chart1.Series["ema"].BorderWidth = 2;
chart1.Series["ema"].ShadowOffset = 1;
}
}
}


Next, if the indicator is not needed, delete it.



private void delete_Click(object sender, EventArgs e)
{
chart1.Series.Remove(ema);
}


I need to be able to add a second, third indicator.
If I try to add a series of the second indicator, an error occurs because the indicator already exists.
You can of course create multiple objects in a class:



Series ema1 = new Series("ema1");
Series ema2 = new Series("ema2");
Series ema3 = new Series("ema3");


but I do not like this method, because I do not know in advance how many indicators will be needed
enter image description here










share|improve this question
























  • I have no idea what to want to achieve. The usual way to use Series is to add DataPoints to them. Do you have any data? What do you mean by 'indicator'?? Are the data bound to a field price?
    – TaW
    Nov 23 '18 at 18:19












  • Yes, " ema "data is calculated based on" price" The indicator is what is drawn " chart1.DataManipulator.FinancialFormula (formula, dig.period, "price", " ema");". The data "price" is getting so: chart1.Series["price"].Points.AddXY(i, h,l,o,c); I added the picture above with explanations. The indicator is calculated based on the parameter "c" of "price"
    – user287629
    Nov 23 '18 at 18:56








  • 1




    OK. so you want to dynamically create more Series, all bound to the data by some formula. What is keeping you? Move the Series declaration to the click and use varying series names. you will need to somehow decide on the relation/scheme for series-name-formula and which is the one to delete.
    – TaW
    Nov 23 '18 at 19:01








  • 1




    Let's not call a Series an object, ok? You can reference each Series that is in the chart.Series collection by its name. So you can do chart1.Series.Remove(chart1.Series[aSeriesName]);. Just know which series you have selected currently..!
    – TaW
    Nov 23 '18 at 19:43






  • 1




    You should probably store the names in a List<string>. But you can also enumerate the chart.Sereis collection. For a user interface solution you may even choose to use a mouseclick and a HitTest on the legend to pick a series. Its Name property can then be used....
    – TaW
    Nov 23 '18 at 21:06


















0














Create an object in the class "Series ema = new Series("ema");"
With the button "indicator_Click" download modal dialog.
In the window using the "ComboBox" select options: dig.type, dig.period.



Series ema = new Series("ema");
**********************************************
private void indicator_Click(object sender, EventArgs e)
{
ModalDialogBox dig = new ModalDialogBox();
{
if (dig.ShowDialog() == DialogResult.OK)
{
string formulaName = dig.type;
FinancialFormula formula = (FinancialFormula)Enum.Parse(typeof(FinancialFormula), formulaName, true);
chart1.Series.Add(ema);
chart1.DataManipulator.FinancialFormula(formula, dig.period, "price", "ema");
chart1.Series["ema"].Color = Color.Red;
chart1.Series["ema"].ChartType = SeriesChartType.Line;
chart1.Series["ema"].BorderWidth = 2;
chart1.Series["ema"].ShadowOffset = 1;
}
}
}


Next, if the indicator is not needed, delete it.



private void delete_Click(object sender, EventArgs e)
{
chart1.Series.Remove(ema);
}


I need to be able to add a second, third indicator.
If I try to add a series of the second indicator, an error occurs because the indicator already exists.
You can of course create multiple objects in a class:



Series ema1 = new Series("ema1");
Series ema2 = new Series("ema2");
Series ema3 = new Series("ema3");


but I do not like this method, because I do not know in advance how many indicators will be needed
enter image description here










share|improve this question
























  • I have no idea what to want to achieve. The usual way to use Series is to add DataPoints to them. Do you have any data? What do you mean by 'indicator'?? Are the data bound to a field price?
    – TaW
    Nov 23 '18 at 18:19












  • Yes, " ema "data is calculated based on" price" The indicator is what is drawn " chart1.DataManipulator.FinancialFormula (formula, dig.period, "price", " ema");". The data "price" is getting so: chart1.Series["price"].Points.AddXY(i, h,l,o,c); I added the picture above with explanations. The indicator is calculated based on the parameter "c" of "price"
    – user287629
    Nov 23 '18 at 18:56








  • 1




    OK. so you want to dynamically create more Series, all bound to the data by some formula. What is keeping you? Move the Series declaration to the click and use varying series names. you will need to somehow decide on the relation/scheme for series-name-formula and which is the one to delete.
    – TaW
    Nov 23 '18 at 19:01








  • 1




    Let's not call a Series an object, ok? You can reference each Series that is in the chart.Series collection by its name. So you can do chart1.Series.Remove(chart1.Series[aSeriesName]);. Just know which series you have selected currently..!
    – TaW
    Nov 23 '18 at 19:43






  • 1




    You should probably store the names in a List<string>. But you can also enumerate the chart.Sereis collection. For a user interface solution you may even choose to use a mouseclick and a HitTest on the legend to pick a series. Its Name property can then be used....
    – TaW
    Nov 23 '18 at 21:06
















0












0








0







Create an object in the class "Series ema = new Series("ema");"
With the button "indicator_Click" download modal dialog.
In the window using the "ComboBox" select options: dig.type, dig.period.



Series ema = new Series("ema");
**********************************************
private void indicator_Click(object sender, EventArgs e)
{
ModalDialogBox dig = new ModalDialogBox();
{
if (dig.ShowDialog() == DialogResult.OK)
{
string formulaName = dig.type;
FinancialFormula formula = (FinancialFormula)Enum.Parse(typeof(FinancialFormula), formulaName, true);
chart1.Series.Add(ema);
chart1.DataManipulator.FinancialFormula(formula, dig.period, "price", "ema");
chart1.Series["ema"].Color = Color.Red;
chart1.Series["ema"].ChartType = SeriesChartType.Line;
chart1.Series["ema"].BorderWidth = 2;
chart1.Series["ema"].ShadowOffset = 1;
}
}
}


Next, if the indicator is not needed, delete it.



private void delete_Click(object sender, EventArgs e)
{
chart1.Series.Remove(ema);
}


I need to be able to add a second, third indicator.
If I try to add a series of the second indicator, an error occurs because the indicator already exists.
You can of course create multiple objects in a class:



Series ema1 = new Series("ema1");
Series ema2 = new Series("ema2");
Series ema3 = new Series("ema3");


but I do not like this method, because I do not know in advance how many indicators will be needed
enter image description here










share|improve this question















Create an object in the class "Series ema = new Series("ema");"
With the button "indicator_Click" download modal dialog.
In the window using the "ComboBox" select options: dig.type, dig.period.



Series ema = new Series("ema");
**********************************************
private void indicator_Click(object sender, EventArgs e)
{
ModalDialogBox dig = new ModalDialogBox();
{
if (dig.ShowDialog() == DialogResult.OK)
{
string formulaName = dig.type;
FinancialFormula formula = (FinancialFormula)Enum.Parse(typeof(FinancialFormula), formulaName, true);
chart1.Series.Add(ema);
chart1.DataManipulator.FinancialFormula(formula, dig.period, "price", "ema");
chart1.Series["ema"].Color = Color.Red;
chart1.Series["ema"].ChartType = SeriesChartType.Line;
chart1.Series["ema"].BorderWidth = 2;
chart1.Series["ema"].ShadowOffset = 1;
}
}
}


Next, if the indicator is not needed, delete it.



private void delete_Click(object sender, EventArgs e)
{
chart1.Series.Remove(ema);
}


I need to be able to add a second, third indicator.
If I try to add a series of the second indicator, an error occurs because the indicator already exists.
You can of course create multiple objects in a class:



Series ema1 = new Series("ema1");
Series ema2 = new Series("ema2");
Series ema3 = new Series("ema3");


but I do not like this method, because I do not know in advance how many indicators will be needed
enter image description here







c# .net winforms mschart






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 21:04

























asked Nov 23 '18 at 17:42









user287629

96




96












  • I have no idea what to want to achieve. The usual way to use Series is to add DataPoints to them. Do you have any data? What do you mean by 'indicator'?? Are the data bound to a field price?
    – TaW
    Nov 23 '18 at 18:19












  • Yes, " ema "data is calculated based on" price" The indicator is what is drawn " chart1.DataManipulator.FinancialFormula (formula, dig.period, "price", " ema");". The data "price" is getting so: chart1.Series["price"].Points.AddXY(i, h,l,o,c); I added the picture above with explanations. The indicator is calculated based on the parameter "c" of "price"
    – user287629
    Nov 23 '18 at 18:56








  • 1




    OK. so you want to dynamically create more Series, all bound to the data by some formula. What is keeping you? Move the Series declaration to the click and use varying series names. you will need to somehow decide on the relation/scheme for series-name-formula and which is the one to delete.
    – TaW
    Nov 23 '18 at 19:01








  • 1




    Let's not call a Series an object, ok? You can reference each Series that is in the chart.Series collection by its name. So you can do chart1.Series.Remove(chart1.Series[aSeriesName]);. Just know which series you have selected currently..!
    – TaW
    Nov 23 '18 at 19:43






  • 1




    You should probably store the names in a List<string>. But you can also enumerate the chart.Sereis collection. For a user interface solution you may even choose to use a mouseclick and a HitTest on the legend to pick a series. Its Name property can then be used....
    – TaW
    Nov 23 '18 at 21:06




















  • I have no idea what to want to achieve. The usual way to use Series is to add DataPoints to them. Do you have any data? What do you mean by 'indicator'?? Are the data bound to a field price?
    – TaW
    Nov 23 '18 at 18:19












  • Yes, " ema "data is calculated based on" price" The indicator is what is drawn " chart1.DataManipulator.FinancialFormula (formula, dig.period, "price", " ema");". The data "price" is getting so: chart1.Series["price"].Points.AddXY(i, h,l,o,c); I added the picture above with explanations. The indicator is calculated based on the parameter "c" of "price"
    – user287629
    Nov 23 '18 at 18:56








  • 1




    OK. so you want to dynamically create more Series, all bound to the data by some formula. What is keeping you? Move the Series declaration to the click and use varying series names. you will need to somehow decide on the relation/scheme for series-name-formula and which is the one to delete.
    – TaW
    Nov 23 '18 at 19:01








  • 1




    Let's not call a Series an object, ok? You can reference each Series that is in the chart.Series collection by its name. So you can do chart1.Series.Remove(chart1.Series[aSeriesName]);. Just know which series you have selected currently..!
    – TaW
    Nov 23 '18 at 19:43






  • 1




    You should probably store the names in a List<string>. But you can also enumerate the chart.Sereis collection. For a user interface solution you may even choose to use a mouseclick and a HitTest on the legend to pick a series. Its Name property can then be used....
    – TaW
    Nov 23 '18 at 21:06


















I have no idea what to want to achieve. The usual way to use Series is to add DataPoints to them. Do you have any data? What do you mean by 'indicator'?? Are the data bound to a field price?
– TaW
Nov 23 '18 at 18:19






I have no idea what to want to achieve. The usual way to use Series is to add DataPoints to them. Do you have any data? What do you mean by 'indicator'?? Are the data bound to a field price?
– TaW
Nov 23 '18 at 18:19














Yes, " ema "data is calculated based on" price" The indicator is what is drawn " chart1.DataManipulator.FinancialFormula (formula, dig.period, "price", " ema");". The data "price" is getting so: chart1.Series["price"].Points.AddXY(i, h,l,o,c); I added the picture above with explanations. The indicator is calculated based on the parameter "c" of "price"
– user287629
Nov 23 '18 at 18:56






Yes, " ema "data is calculated based on" price" The indicator is what is drawn " chart1.DataManipulator.FinancialFormula (formula, dig.period, "price", " ema");". The data "price" is getting so: chart1.Series["price"].Points.AddXY(i, h,l,o,c); I added the picture above with explanations. The indicator is calculated based on the parameter "c" of "price"
– user287629
Nov 23 '18 at 18:56






1




1




OK. so you want to dynamically create more Series, all bound to the data by some formula. What is keeping you? Move the Series declaration to the click and use varying series names. you will need to somehow decide on the relation/scheme for series-name-formula and which is the one to delete.
– TaW
Nov 23 '18 at 19:01






OK. so you want to dynamically create more Series, all bound to the data by some formula. What is keeping you? Move the Series declaration to the click and use varying series names. you will need to somehow decide on the relation/scheme for series-name-formula and which is the one to delete.
– TaW
Nov 23 '18 at 19:01






1




1




Let's not call a Series an object, ok? You can reference each Series that is in the chart.Series collection by its name. So you can do chart1.Series.Remove(chart1.Series[aSeriesName]);. Just know which series you have selected currently..!
– TaW
Nov 23 '18 at 19:43




Let's not call a Series an object, ok? You can reference each Series that is in the chart.Series collection by its name. So you can do chart1.Series.Remove(chart1.Series[aSeriesName]);. Just know which series you have selected currently..!
– TaW
Nov 23 '18 at 19:43




1




1




You should probably store the names in a List<string>. But you can also enumerate the chart.Sereis collection. For a user interface solution you may even choose to use a mouseclick and a HitTest on the legend to pick a series. Its Name property can then be used....
– TaW
Nov 23 '18 at 21:06






You should probably store the names in a List<string>. But you can also enumerate the chart.Sereis collection. For a user interface solution you may even choose to use a mouseclick and a HitTest on the legend to pick a series. Its Name property can then be used....
– TaW
Nov 23 '18 at 21:06














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%2f53450998%2fhow-to-create-many-series%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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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%2f53450998%2fhow-to-create-many-series%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







Popular posts from this blog

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

Calculate evaluation metrics using cross_val_predict sklearn

Insert data from modal to MySQL (multiple modal on website)