Print Page | Close Window

Chart reset problem

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Chart Control
Forum Description: Topics Related to Codejock Chart Control
URL: http://forum.codejock.com/forum_posts.asp?TID=23339
Printed Date: 03 December 2024 at 1:11pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Chart reset problem
Posted By: sword warrior
Subject: Chart reset problem
Date Posted: 19 May 2017 at 4:05am
Hi.

I'm a beginner of VB.net and tried to build a line chart. Every time I run the code,it seems that chartcontrol doesn't refresh itself,just keep print the title.Here's my code:

Public Sub ChartControl1_Initialize()

    Dim Series As ChartSeries
    Set Series = ChartControl1.Content.Series.Add("New York")
    ...
    ChartControl1.Content.Titles.Add "Population by U.S. State"
    ChartControl1.Content.Legend.Visible = True
    ...

End Sub

And if I run the program 5 times,it looks like:

Population by U.S. State
Population by U.S. State
Population by U.S. State
Population by U.S. State
Population by U.S. State
[chart]

Is there any code to reset the chartcontrol?Or just because I wrote the code in a wrong way?




Replies:
Posted By: wrecks
Date Posted: 18 June 2017 at 10:51am
Use
 ChartControl1.Content.Titles.DeleteAll
before you 
 ChartControl1.Content.Titles.Add

Or, you might be better off just deleting the entire chart each time you start again.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net