Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Tools for Microsoft .Net
 QCChart3D 3D Charting Tools for .Net (VB and C#)
 Refreshing chart Object

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

T O P I C    R E V I E W
victorvikas Posted - 08 Mar 2007 : 09:32:56
Hi,
While using Quinn-Curtis Charting tool for my windows application in .Net Framework 2.0 , I have a situation where I have to generate different charts at the same chart object on different button clicks.
The problem is that the previous charts are also been displayed with new charts. So is there any way to refresh or clear the chart area before initializing different chart on it??
Reply as soon as possible.
Thanks & Regards,
Vikas Agarwal
+919999190313
8   L A T E S T    R E P L I E S    (Newest First)
victorvikas Posted - 19 Mar 2007 : 03:49:02
Hi

I had found solution to my problem. Actually rotateButton is a chart control not a chartObject, so ResetChartObjectList will obviously not reset the rotateButton , thats why all other items ( chartObject) of my chart are working fine but not the RotateButton.

For it to work I have used this.chartview.controls.clear() in the begining of InitializeChart along with ChartResetObjectList().

Thanks for your support.

Vikas
victorvikas Posted - 19 Mar 2007 : 03:05:35
Hi Sir,

in refrence to previous posts.

I m still facing the same problems of not getting rotatebutton re-activated after its first use. I have used ChartResetObjectList and UpdateDraw properties at their respective places. I m using your trial version for my windows application.
Please respond with the quick solution for it.

Thanks & Regards
Vikas
+919999190313
quinncurtis Posted - 09 Mar 2007 : 13:11:13
It may be that you are simply not calling the ChartView UpdateDraw method after you recreate the graph. See our previous example.

If you do not call UpdateDraw, then the graph will not update to reflect the changes. You seem to imply that ONLY the rotate button and data tooltips don't work. If you don't call UpdateDraw, the graph will not update to reflect new data either.
quinncurtis Posted - 09 Mar 2007 : 10:56:50
Please do not post large block of code in the forum unless we explicity ask for it. It makes the thread un-readable. If you have a complete, SIMPLE, example program that we can run, you can send it to support@quinn-curtis.com. Do not send us program we cannot compile and run.

Are you working with a trial version of the software, or a commercial version ?

We cannot see what your problem is by inspection of your code. Since it is tied to a database we cannot run the code. We modified one of our example programs, MultiAxesChart, adding the ResetChartObjectList at the top of the InitializeChart method, and placing a call to InitializeChart in the button2_Click handler. That way the chart is recreated everytime the 50 button is clicked. The rotate button and the tooltips continue to work. We could not reproduce the problem.

private void button2_Click(object sender, System.EventArgs e)
{
//	RescaleAxes(50.0);
	InitializeChart();
	this.UpdateDraw();		
}


See if you can reproduce the problem using one of our example programs.
victorvikas Posted - 09 Mar 2007 : 10:34:26
Hi

here i have attached my code of c#. as you can see i m calling the "chartVu.ResetChartObjectList();" at the strat of code and then adding all the required controls. please tell me where i m wrong as with this code i m not been able to use rotate function after reset the chart object first time.

Vikas.
vikas.agarwal@hcl.in

using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using com.quinncurtis.chart3dnet;
using System.Data.SqlClient;

namespace HCL.DBLab.Charts
{
    public partial class Charts : UserControl
    {
        /// <summary> 
        /// Required designer variable to define type of coordinate system choosen for charting.
        /// </summary>
        CartesianCoordinates pTransform1;

        public Charts()
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();
        }
        /// <summary>
        /// This method actually plots the required chart using the information from server.
        /// </summary>
        public void InitializeChart(DataTable diagramTable, int diagramDimension, int diagramType)
        {
            DataView dv0 = new DataView(diagramTable, "DIMENSION = '0'", "DIMENSION", DataViewRowState.CurrentRows);
            dv0.Sort = "planno";
            DataView dv1 = new DataView(diagramTable, "DIMENSION = '1'", "DIMENSION", DataViewRowState.CurrentRows);
            dv1.Sort = "planno";
            int planCount = Convert.ToInt32(dv0[dv0.Count - 1][4]);
            ChartView chartVu = this.chartView;

            

            chartVu.ResetChartObjectList();
            Font theFont = new Font("Microsoft Sans Serif", 10, FontStyle.Bold);

            int planCounter = 0;
            int elementCounter = 0;
            int[] planElement = new int[planCount + 1];
            for (int counter = 0; counter < dv0.Count; counter++)
            {
                if (planCounter != (int)dv0[counter][4])
                {
                    planCounter = planCounter + 1;
                    elementCounter = 0;
                }
                planElement[planCounter] = elementCounter + 1;
                elementCounter++;
            }
            double[][] x = new double[planCount + 1][];
            double[][] y = new double[planCount + 1][];
            double[][] z = new double[planCount + 1][];
            double[] x1 = new double[1];
            double[] y1 = new double[1];
            double[] z1 = new double[1];
            for (int dataDimension = 0; dataDimension <= planCount; dataDimension++)
            {
                x[dataDimension] = new double[planElement[dataDimension]];
                y[dataDimension] = new double[planElement[dataDimension]];
                z[dataDimension] = new double[planElement[dataDimension]];
            }
            int plCounter = 0;
            int elCounter = 0;
            for (int dataFeeder = 0; dataFeeder < dv0.Count; dataFeeder++)
            {
                if (plCounter != (int)dv0[dataFeeder][4])
                {
                    plCounter = plCounter + 1;
                    elCounter = 0;
                }
                if ((diagramDimension <= 2) && ((diagramType !=1) && (diagramType != 2)))
                {
                    x[plCounter][elCounter] = Convert.ToDouble(dv0[dataFeeder][5]);
                }
                else 
                {
                    x[plCounter][elCounter] = Convert.ToDouble(dv1[dataFeeder][5]);
                }
                if (diagramDimension >= 2)
                {
                    if ((diagramType == 1) || (diagramType == 2))
                    {
                        y[plCounter][elCounter] = Convert.ToDouble(dv0[dataFeeder][5]);
                    }
                    else
                    {
                        y[plCounter][elCounter] = Convert.ToDouble(dv0[dataFeeder][6]);
                    }
                }
                if (diagramDimension == 3)
                {
                    z[plCounter][elCounter] = Convert.ToDouble(dv0[dataFeeder][5]);
                }
                elCounter++;
            }
            pTransform1 = new CartesianCoordinates(ChartObj.LINEAR_SCALE, ChartObj.LINEAR_SCALE);
            Color[] color = { Color.Blue, Color.Maroon, Color.Red, Color.Yellow, 
Color.AliceBlue,Color.AntiqueWhite,Color.Azure,Color.Black,
Color.Brown,Color.Crimson,Color.Crimson,Color.DarkBlue,
Color.DarkOrange,Color.Gold,Color.Firebrick,Color.GreenYellow,
Color.PaleVioletRed,Color.Pink,Color.Tomato};
            SimpleDataset3D[] Dataset = new SimpleDataset3D[planCount + 1];
            ChartAttribute[] attrib = new ChartAttribute[planCount + 1];
            SimpleScatterPlot[] thePlot = new SimpleScatterPlot[planCount + 1];
            SimpleDataset[] datasetarray = new SimpleDataset[planCount + 2];
            SimpleDataset3D Dataset4 = new SimpleDataset3D("Fourth", x1, y1, z1);
            // Create datasets
            for (int dataSetCount = 0; dataSetCount <= planCount; dataSetCount++)
            {
                string name = "planno." + dataSetCount.ToString();
                Dataset[dataSetCount] = new SimpleDataset3D(name, x[dataSetCount], y[dataSetCount], z[dataSetCount]);
                datasetarray[dataSetCount] = Dataset[dataSetCount];
            }
            datasetarray[planCount + 1] = Dataset4;
            pTransform1.AutoScale(datasetarray, ChartObj.AUTOAXES_FAR, ChartObj.AUTOAXES_FAR);
            for (int dataSetCount = planCount; dataSetCount >= 0; dataSetCount--)
            {
                attrib[dataSetCount] = new ChartAttribute(color[dataSetCount], 33, DashStyle.Solid, color[dataSetCount]);
                attrib[dataSetCount].SetSymbolSize(33);
                thePlot[dataSetCount] = new SimpleScatterPlot(pTransform1, Dataset[dataSetCount], ChartObj.CUBE3D, attrib[dataSetCount]);
                thePlot[dataSetCount].SetSegmentAttributesMode(false);
                chartVu.AddChartObject(thePlot[dataSetCount]);
            }

            // Position chart in graph area
            pTransform1.SetGraphBorderDiagonal(0.2, .25, .650, 0.800);

            // Set rotational parameters
            pTransform1.AbsRotateCoordinateSystem(new Point3D(0, 0, 0));

            // Define chart background
            Background background = new Background(pTransform1, ChartObj.GRAPH_BACKGROUND, Color.White);
            chartVu.AddChartObject(background);


            // Define x-axis
            LinearAxis xAxis = new LinearAxis(pTransform1, ChartObj.X_AXIS);
            xAxis.SetAxisIntercept(0.0);
            chartVu.AddChartObject(xAxis);
            // Define y-axis
            LinearAxis yAxis = new LinearAxis(pTransform1, ChartObj.Y_AXIS);

            // Define x-axis labels
            NumericAxisLabels xAxisLab = new NumericAxisLabels(xAxis);
            xAxisLab.SetTextFont(theFont);
            chartVu.AddChartObject(xAxisLab);

            // Define x-axis titles
            Font titleFont = new Font("Microsoft Sans Serif", 10, FontStyle.Bold);
            AxisTitle xaxistitle = new AxisTitle(xAxis, titleFont, "title2");
            chartVu.AddChartObject(xaxistitle);

            // Define fourth plot as a scatter plot using 3D data
            ChartAttribute attrib4 = new ChartAttribute(Color.Transparent, 3, DashStyle.Dot, Color.Transparent);
            attrib4.SetSymbolSize(0);
            SimpleScatterPlot thePlot4 = new SimpleScatterPlot(pTransform1, Dataset4, ChartObj.CUBE3D, attrib4);
            thePlot4.SetSegmentAttributesMode(false);
            chartVu.AddChartObject(thePlot4);

            // Define title
            Font theTitleFont = new Font("Microsoft Sans Serif", 14, FontStyle.Bold);
            ChartTitle mainTitle = new ChartTitle(theTitleFont, "Compilation Cost Diagram");
            mainTitle.SetTitleType(ChartObj.CHART_HEADER);
            mainTitle.SetTitlePosition(ChartObj.CENTER_GRAPH);
            chartVu.AddChartObject(mainTitle);

            // Add a line to the top of the graph
            GraphicsPath titleLine = new GraphicsPath();
            titleLine.AddLine(0.0f, 0.1f, 1.0f, 0.1f);
            ChartShape titleLineShape = new ChartShape(titleLine,
            ChartObj.NORM_GRAPH_POS, 0.0, 0.0, ChartObj.NORM_GRAPH_POS, 0);
            titleLineShape.SetLineWidth(3);
            chartVu.AddChartObject(titleLineShape);

            // Define a tooltip
            Font toolTipFont = new Font("Microsoft Sans Serif", 10, FontStyle.Regular);
            DataToolTip datatooltip = new DataToolTip(chartVu);
            NumericLabel xValueTemplate = new NumericLabel(ChartObj.DECIMALFORMAT, 0);


            ChartText textTemplate = new ChartText(toolTipFont, "");
            textTemplate.SetTextBgColor(Color.FromArgb(255, 255, 204));
            textTemplate.SetTextBgMode(true);
            ChartSymbol toolTipSymbol = new ChartSymbol(null, ChartObj.SQUARE, new ChartAttribute(Color.Green));
            toolTipSymbol.SetSymbolSize(10.0);
            datatooltip.SetTextTemplate(textTemplate);
            datatooltip.SetXValueTemplate(xValueTemplate);
            datatooltip.SetDataToolTipFormat(ChartObj.DATA_TOOLTIP_X);

            if (diagramDimension >= 2)
            {
                // Add y-axis
                chartVu.AddChartObject(yAxis);

                // Define y-axis labels
                NumericAxisLabels yAxisLab = new NumericAxisLabels(yAxis);
                yAxisLab.SetTextFont(theFont);
                chartVu.AddChartObject(yAxisLab);

                // Define y-axis titles
                AxisTitle yaxistitle = new AxisTitle(yAxis, titleFont, "title1");
                chartVu.AddChartObject(yaxistitle);

                NumericLabel yValueTemplate = new NumericLabel(ChartObj.DECIMALFORMAT, 1);
                datatooltip.SetYValueTemplate(yValueTemplate);
                datatooltip.SetDataToolTipFormat(ChartObj.DATA_TOOLTIP_XY_TWOLINE);
            }

            if (diagramDimension == 3)
            {
                pTransform1.AbsRotateCoordinateSystem(new Point3D(15, 30, 5));
                // Define walls
                ChartAttribute wallAttrib = new ChartAttribute(Color.Black, 1, DashStyle.Solid, Color.Snow);
                Wall3D xyMinZWall = new Wall3D(pTransform1, ChartObj.XY_MAXZ_PLANE, 0.002, wallAttrib);
                chartVu.AddChartObject(xyMinZWall);
                Wall3D yzMinXWall = new Wall3D(pTransform1, ChartObj.YZ_MINX_PLANE, 0.002, wallAttrib);
                chartVu.AddChartObject(yzMinXWall);
                Wall3D xzMinYWall = new Wall3D(pTransform1, ChartObj.XZ_MINY_PLANE, 0.002, wallAttrib);
                chartVu.AddChartObject(xzMinYWall);

                // Define z-axis
                LinearAxis zAxis = new LinearAxis(pTransform1, ChartObj.Z_AXIS);
                zAxis.AxisIntercept2 = yAxis.AxisMin;
                zAxis.AxisTickSpace = 5;
                zAxis.AxisMinorTicksPerMajor = 5;
                chartVu.AddChartObject(zAxis);

                // Define z-axis labels
                NumericAxisLabels zAxisLab = new NumericAxisLabels(zAxis);
                zAxisLab.SetTextFont(theFont);
                chartVu.AddChartObject(zAxisLab);

                // Define z-axis titles
                AxisTitle zaxistitle = new AxisTitle(zAxis, titleFont, "title3");
                chartVu.AddChartObject(zaxistitle);

                NumericLabel zValueTemplate = new NumericLabel(ChartObj.DECIMALFORMAT, 2);
                datatooltip.SetYValueTemplate(zValueTemplate);
                datatooltip.SetDataToolTipFormat(ChartObj.DATA_TOOLTIP_XYZ_THREELINE);
            }

            datatooltip.SetToolTipSymbol(toolTipSymbol);
            datatooltip.SetEnable(true);
            chartVu.AddMouseListener(datatooltip);

            // Add a rotate control button to the upper left corner
            RotateButtonUserControl rotatebutton = new RotateButtonUserControl(pTransform1);
            rotatebutton.Size = new Size(32, 32);
            rotatebutton.Location = new Point(8, 8);
            chartVu.Controls.Add(rotatebutton);
        }
    }
}

quinncurtis Posted - 09 Mar 2007 : 09:22:49
If you call the ResetChartObjectList method, you must re-add any of our controls (RotateButtonUserControl), and any mouse listeners (DataToolTip), just as if you were creating the chart from scratch, which in effect you are.
victorvikas Posted - 09 Mar 2007 : 01:47:03
But when i used ResetChartObjectList method , the controls like rotate button and datatooltip stopped functioning, though the code is same as before only i added chartview.ResetChartObjectList at the begining of code.

Vikas
quinncurtis Posted - 08 Mar 2007 : 09:42:32
Call the ChartView ResetChartObjectList method to remove all of the previous objects you added to the ChartView.

Quinn-Curtis Forums © 2000-2018 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07