Page 1 of 2

Bubble value displayed within the bubble itself

Posted: Tue Aug 22, 2006 10:01 am
by 9089490
Hi I am trying to display the numerical value on top of each bubble that is displayed within a grid. is this possible with the bubble charts

Posted: Tue Aug 22, 2006 11:06 am
by narcis
Hi Chuck,

Yes, this is possible using series marks as shown here:

Code: Select all

Private Sub Form_Load()
    With TChart1.Series(0)
        .FillSampleValues 10
        .Marks.Visible = True
        
        'You can play with ArrowLength to position the marks
        .Marks.ArrowLength = -5
        .Marks.Arrow.Visible = False
    End With
End Sub

Posted: Tue Aug 22, 2006 12:14 pm
by 9089490
Hi Thanks, This is something like what I want but this is displaying the Ax value of the bubble. i wish it to display the ARadius value of the bubble. See code below.

pointColor= Convert.ToUInt32(System.Drawing.ColorTranslator.ToOle(SeriesColor(seriesNum)));
axTChart2.Series(seriesNum).ColorEachPoint = false;
axTChart2.Series(seriesNum).asBubble.AddBubble(Convert.ToDouble(dr[X]),Convert.ToDouble(dr[Y]),(Convert.ToDouble(dr[Mag])/fr)/2, "",16777215);
axTChart2.Series(seriesNum).asBubble.Pointer.Pen.Color = pointColor;
axTChart2.Series(seriesNum).asBubble.Pointer.Pen.Style = TeeChart.EChartPenStyle.psSolid;
axTChart2.Series(seriesNum).asBubble.Pointer.Pen.Width = 1;
axTChart2.Series(seriesNum).asBubble.Pointer.Pen.Visible = true;
axTChart2.Series(seriesNum).Marks.Visible = true;

Posted: Tue Aug 22, 2006 2:02 pm
by narcis
Hi Chuck,

Ok, you can achieve that using the OnGetSeriesMark event as shown here:

Code: Select all

		private void Form1_Load(object sender, System.EventArgs e)
		{
			this.axTeeCommander1.Parent=this.axTChart1;

			this.axTChart1.Series(0).FillSampleValues(10);
			this.axTChart1.Series(0).Marks.Visible=true;
		}

		private void axTChart1_OnGetSeriesMark(object sender, AxTeeChart.ITChartEvents_OnGetSeriesMarkEvent e)
		{
			e.markText = this.axTChart1.Series(0).asBubble.RadiusValues.get_Value(e.valueIndex).ToString();
		}

Posted: Tue Aug 22, 2006 2:12 pm
by 9089490
Thanks for this but I don't see how I can encorporate this within my code. I am looping through each series so where would the onGetSeriesMark event be caled from there??

Posted: Tue Aug 22, 2006 2:22 pm
by narcis
Hi Chuck,

OnGetSeriesMark is called for every series so you can use e.seriesIndex:

Code: Select all

		private void axTChart1_OnGetSeriesMark(object sender, AxTeeChart.ITChartEvents_OnGetSeriesMarkEvent e)
		{
			e.markText = this.axTChart1.Series(e.seriesIndex).asBubble.RadiusValues.get_Value(e.valueIndex).ToString();
		}

Posted: Tue Aug 22, 2006 2:31 pm
by 9089490
Thanks but this is still not working. See my code below:

foreach(DataRow dr in datarows)
{
if (getPageName(dr) == pg)
{
if (dr[X] != System.DBNull.Value && dr[Y]!= System.DBNull.Value && dr[Mag] != System.DBNull.Value)
{
string sery = getCurveName(dr);
System.UInt32 pointColor;
int seriesNum = series.IndexOf(sery);
if (seriesNum < 0)
{
seriesNum = series.Add(sery);
axTChart2.AddSeries(TeeChart.ESeriesClass.scBubble);
axTChart2.Series(seriesNum).Title = sery;
}
pointColor= Convert.ToUInt32(System.Drawing.ColorTranslator.ToOle(SeriesColor(seriesNum)));
axTChart2.Series(seriesNum).ColorEachPoint = false;
axTChart2.Series(seriesNum).asBubble.AddBubble(Convert.ToDouble(dr[X]),Convert.ToDouble(dr[Y]),(Convert.ToDouble(dr[Mag])/fr)/2, "",16777215);
axTChart2.Series(seriesNum).asBubble.Pointer.Pen.Color = pointColor;
axTChart2.Series(seriesNum).asBubble.Pointer.Pen.Style = TeeChart.EChartPenStyle.psSolid;
axTChart2.Series(seriesNum).asBubble.Pointer.Pen.Width = 1;
axTChart2.Series(seriesNum).asBubble.Pointer.Pen.Visible = true;
axTChart2.Series(seriesNum).Marks.Visible = true;
}
}
}


private void axTChart2_OnGetSeriesMark(object sender, AxTeeChart.ITChartEvents_OnGetSeriesMarkEvent e,int seriesnum)
{
e.markText = this.axTChart2.Series(e.seriesIndex).asBubble.RadiusValues.get_Value(e.valueIndex).ToString();
}

How is the OnGetSeriesMark called from the main chart creation?

Realy appreciate your help here!!

Posted: Tue Aug 22, 2006 2:47 pm
by narcis
Hi Chuck,

You can define the event at the design view, at the AxTChart properties window or at run-time like this:

Code: Select all

		private void Form1_Load(object sender, System.EventArgs e)
		{
			this.axTeeCommander1.Parent=this.axTChart1;

			this.axTChart1.Series(0).FillSampleValues(10);
			this.axTChart1.Series(0).Marks.Visible=true;

			this.axTChart1.OnGetSeriesMark += new AxTeeChart.ITChartEvents_OnGetSeriesMarkEventHandler(axTChart1_OnGetSeriesMark);
		}

		private void axTChart1_OnGetSeriesMark(object sender, AxTeeChart.ITChartEvents_OnGetSeriesMarkEvent e)
		{
			e.markText = this.axTChart1.Series(e.seriesIndex).asBubble.RadiusValues.get_Value(e.valueIndex).ToString();
		}

Posted: Tue Aug 22, 2006 3:22 pm
by 9089490
Hi Hate to keep at this but I amgetting Object reference not set to an instance of an object when the event handler is generated. is there any other method of retreiving this value?

Posted: Tue Aug 22, 2006 3:30 pm
by narcis
Hi Chuck,

Could you please send us an example we can run "as-is" to reproduce the problem here? You can post your files at news://www.steema.net/steema.public.attachments newsgroup.

Thanks in advance.

Posted: Tue Aug 22, 2006 3:32 pm
by 9089490
Is it possible to send via email. I have no access to newsgroups

Posted: Wed Aug 23, 2006 7:28 am
by narcis
Hi Chuck,

Ok, please send your example to me.

Posted: Wed Aug 23, 2006 11:00 am
by 9089490
Hi I was just wondering if that code got to you via e-mail?

Posted: Wed Aug 23, 2006 11:22 am
by narcis
Hi Chuck,

Yes I received the code and we will review it and reply here ASAP.

Posted: Thu Aug 24, 2006 10:14 am
by 9089490
Hi narcis, Iw as wondering if you could come up with a solution to the bubble plot not showing radius marks for me.

Thanks..