I have a stacked column ms chart in which all charts have 3 series / values. If a certain condition exists, I would like to add an additional series to the chart. In the image below, the additional series on the chart appears at the first and second indexed column. I would like the additional stacked column to appear on the 2nd and 9th position. Any idea on how I would do this?
protected void Page_Load(object sender, System.EventArgs e)
{
// Populate series data
Random random = new Random();
for(int pointIndex = 0; pointIndex < 10; pointIndex++)
{
Chart1.Series[0].Points.AddY(10);
Chart1.Series[1].Points.AddY(50);
Chart1.Series[2].Points.AddY(30);
if (pointIndex == 1 || pointIndex == 8)
{
//both commented out code blocks break chart
//Chart1.Series[3].Points.AddXY(40,pointIndex);
//Chart1.Series[3].Points.AddXY(pointIndex,40);
Chart1.Series[3].Points.AddXY(0,40);//.AddXY(0,40);
}
}
}
All the series needs to be aligned correctly. So you should enter empty Data points where you do not need points. Example
if (pointIndex == 1 || pointIndex == 8)
{
Chart1.Series[3].Points.AddY(40);
}
else
{
Chart1.Series[3].Points.Add( new DataPoint() { IsEmpty = true } );
}
Related
I want to build an application that calculates large computations using an idle timer. The progress bar works fine for small numbers but if I enter large numbers as input the progress bar does not display anything.
Code, where I set the QProgressbar, is as shown below.
void MainWindow::on_startButton_clicked()
{
numberEntered = ui->inputValue->text().toInt();
QIntValidator * validator = new QIntValidator(this);
ui->inputValue->setValidator(validator);
ui->progressBar->setMaximum(numberEntered);
globalIndex = 0;
timer->start(0);
ui->resultArea->append(QString("STARTED"));
}
and in another place
void MainWindow::countManager()
{
if(globalIndex == 0){
ui->resultArea->append(QString("%1 : is a Prime number").arg(globalIndex));
ui->progressBar->setValue(globalIndex);
}
if(globalIndex <= numberEntered && globalIndex != 0){
int result = primeNumberCalculator(globalIndex);
ui->progressBar->setValue(globalIndex);
if(result !=0){
ui->resultArea->append(QString("%1 : is a Prime number").arg(result));
}
}
if(numberEntered == globalIndex){
timer->stop();
ui->resultArea->append(QString("End of count!!"));
}
globalIndex++;
}
Ihave a report and the report has different value positive or negative then I want to calculate like that positive values are gathered themselves and negative values are gathered themselves. for example 10,20 =30 and -10-20=-30
You can use event SummaryRowChanged and set manually your logic:
public double PositiveSumm = 0;
public double NegativeSumm = 0;
private void xrTableCell1_SummaryRowChanged(object sender, EventArgs e)
{
var currentVal = Convert.ToDouble(GetCurrentColumnValue("ColumnName"));
if (currentVal > 0)
{
PositivSumm += currentVal;
}
else
{
NegativSumm += currentVal;
}
}
I'm using tutorial_Form_Table.
The table has dynamically assigned values, something like:
for (col = 1; col <= 5; col++)
{
for (row = 1; row <= 5; row++)
{
if ((col == 2) || (col == 4))
{
if (row > 1)
table.cell(col,row).data(row*col);
else
table.cell(col,row).data("Text "+int2str(row*col));
}
else
table.cell(col,row).data("Text "+int2str(row*col));
}
}
I need to get the position of the cell when I enter new value in it, so I can update the corresponding table with the value entered.
Thank you.
Table has two properties: row() and column() which return values of current active cell.
public void activeCellChanged()
{
super();
info(strFmt('%1 %2 %3', Table.row(), Table.column(), Table.cell(Table.column(), Table.row()).data()));
}
On each of the controls you add to the table control you can override the modified method to see the new value you entered.
public boolean modified()
{
boolean ret;
ret = super();
info(strFmt('New data that we need to save: %1, %2 -> %3', Table.row(), Table.column(), Table.cell(Table.column(), Table.row()).data()));
return ret;
}
If you are working with a lot of data you should consider using some other control such as .NET grid control because of performance issues.
I need to distinguish ten consecutive cells.
Each one in a row, if they have different values, when databindind the values to a gridview.
so,this cells have different value. if this cells value is <=3 then color is red and cells value >3 color is green.
I need to color each cell using for loop condition.please any person tells me this solutions.What is the best way to do it?
Try in RowDataBound
protected void YourGrid_RowDataBound(object sender, GridViewRowEventArgs e)
{
int _value = Int32.Parse(((DataRowView)e.Row.DataItem)["<column_name>"].ToString());
if (_value <= 3)
{
e.Rows.ForeColor = Color.Red;
}
else if (_value > 3)
{
e.Rows.ForeColor = Color.Green;
}
}
i have a table array dynamically generated from a data query and stored in a session variable. Now i wanna add a textbox to limit how many rows at a time i will display. To test this, i wrote two button methods, one will set some rows to be visible = false, and the second button method will set the same rows back to visible = true.
protected void limit_btn_Click(object sender, EventArgs e)
{
for (int i = 0; i < traceTables.Length; i++)
for (int j = 2; j < traceTables[i].Rows.Count; j++)
traceTables[i].Rows[j].Visible = false;
Session["Tables"] = traceTables;
table_C();
}//end limit_btn_Click()
protected void obo_btn_Click(object sender, EventArgs e)
{
for (int i = 0; i < traceTables.Length; i++)
for (int j = 2; j < traceTables[i].Rows.Count; j++)
traceTables[i].Rows[j].Visible = true;
Session["Tables"] = traceTables;
table_C();
}//end obo_btn_Click()
protected void table_C()
{
String changeTo = log_locations.SelectedValue;
for (int i = 0; i < sshLoc.Length; i++)
{
if (sshLoc[i].CompareTo(changeTo) == 0)
{
table_panel.ContentTemplateContainer.Controls.Remove(traceTables[currentTable]);
System.Diagnostics.Debug.WriteLine("Removing " + sshLoc[currentTable]);
table_panel.ContentTemplateContainer.Controls.Add(traceTables[i]);
System.Diagnostics.Debug.WriteLine("Adding " + sshLoc[i]);
currentTable = i;
Session["CurrentTable"] = currentTable;
break;
}//end if
}//end for
}//end table_C()
table_C() basically removes and adds the table from the panel - i use it when i want to switch between tables from a dropdown list (which works) and in this case it simply removes and adds the same table from the panel content container.
The problem is that setting the rows to be not visible works fine. Setting the rows back to visible never does, and i'm not sure why
Try using display:none and display:visible rather than .visible in ASP
traceTables[i].Rows[j].Add("style","display:none");
Visible removes it completely from the HTML, so you can only show it again by recreating the page.
You need to store data in a list rather than in a table.
When you set the rows to not visible they are being removed from the html table. That is why you cannot set them to visible again.
If you store the data in a seperate object and bind it to the list, you will be able to turn visibility on and off.