Skip to content

Commit

Permalink
adding support for line series
Browse files Browse the repository at this point in the history
  • Loading branch information
JulsMan committed Sep 2, 2015
1 parent f4cc4e4 commit d403b5d
Show file tree
Hide file tree
Showing 160 changed files with 124,936 additions and 55 deletions.
1,046 changes: 1,046 additions & 0 deletions .vs/config/applicationhost.config

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions GoogleChartsNGraphsControls/BaseDesignTimeSupport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ private string getDashDotted(LINETYPE? LT)

public ComboChartLineSeries()
{
this.LineType = SeriesType.Line;
this.LineType = SeriesType.SteppedArea;
}

public int Column { get; set; }
Expand Down Expand Up @@ -723,9 +723,9 @@ public override string ToString()


if (options.Count() > 0)
return string.Format("{0}: {{ type:'{1}', {2} }}", Column, LineType.ToString().ToLower(), string.Join(", ", options));
return string.Format("{0}: {{ type:'{1}', {2} }}", Column, LineType.ToString().LowerCaseFirst(), string.Join(", ", options));
else
return string.Format("{0}: {{ type:'{1}' }}", Column, LineType.ToString().ToLower());
return string.Format("{0}: {{ type:'{1}' }}", Column, LineType.ToString().LowerCaseFirst());
}
}
[Serializable()]
Expand Down
4 changes: 4 additions & 0 deletions GoogleChartsNGraphsControls/BaseEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ public class BaseEvents
public event EventHandler ClickEvent;

}




}
12 changes: 8 additions & 4 deletions GoogleChartsNGraphsControls/BaseGVI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public enum GOOGLECHART
google.load('visualization', '1');
google.setOnLoadCallback( draw_{0} );
var chart_{0} = undefined;
function draw_{0}() {{
var container = document.getElementById('{0}');
var chart = new links.{3}(container);
Expand Down Expand Up @@ -84,10 +85,13 @@ public enum GOOGLECHART
{formatter}
}};
/********* User Defined Functions **********************/
{4}
/********* Extended Params **********************/
/********* User Defined Functions **********************/
{4}
/********* Extended Params **********************/
chart.opts = {1};
chart.container = container;
Expand Down Expand Up @@ -421,7 +425,7 @@ internal List<string> RenderGVIEvents(WebControl PageControl)

if ((value == null) || (string.IsNullOrEmpty(value.ToString()))) continue;

string foo = string.Format("google.visualization.events.addListener(chart, '{0}', {1});", option.EventName, value);
string foo = string.Format("google.visualization.events.addListener(chart, '{0}', chart.{1} = function(){{ {1}(chart); }});", option.EventName, value);
foo = foo.Replace(";;", ";");
eventsList.Add(foo);
}
Expand Down
5 changes: 3 additions & 2 deletions GoogleChartsNGraphsControls/BaseWebControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1128,10 +1128,10 @@ protected override void OnLoad(EventArgs e)

}





#region Event Work


/*************************************************************************
*
Expand Down Expand Up @@ -1202,6 +1202,7 @@ void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
// " Value = 'Click Me' />");
//}

#endregion

public virtual string PostProcessData(string DATATABLE)
{
Expand Down
160 changes: 153 additions & 7 deletions GoogleChartsNGraphsControls/CHAPTimeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,152 @@ namespace GoogleChartsNGraphsControls
[DataContract]
public class CHAPTimeline : BaseWebControl
{

[GviConfigOption]
[GviEventOption("changed")]
[Bindable(true)]
[Category("Events")]
[Description(@"The properties of an event changed. Fired after the user modified the start date or end date of an event by moving (dragging) the event in the Timeline.
The selected row can be retrieved via the method getSelection, and new start and end data can be read in the according row in the data table.
The changed event can be canceled by calling the method cancelChange from within the event listener. This is useful when changes need to be approved.")]
[DataMember(Name = "changed", EmitDefaultValue = true, IsRequired = false)]
public string GviOnChanged
{
get
{
string s = (string)ViewState["GviOnChanged"];
return s;
}
set
{
ViewState["GviOnChanged"] = value;
}
}


[GviConfigOption]
[GviEventOption("add")]
[Bindable(true)]
[Category("Events")]
[Description(@"An event is about the be added. Fired after the user has clicked the button 'Add event' and created a new event by clicking or moving an event into the Timeline.
The selected row can be retrieved via the method getSelection, and new start and end data can be read in the according row in the data table.
The add event can be canceled by calling the method cancelAdd from within the event listener.This is useful when additions need to be approved.")]
[DataMember(Name = "add", EmitDefaultValue = true, IsRequired = false)]
public string GviOnAdd
{
get
{
string s = (string)ViewState["GviOnAdd"];
return s;
}
set
{
ViewState["GviOnAdd"] = value;
}
}


[GviConfigOption]
[GviEventOption("edit")]
[Bindable(true)]
[Category("Events")]
[Description(@"An event is about to be edited. This event is fired when the user double clicks on an event. The selected row can be retrieved via the method getSelection.")]
[DataMember(Name = "edit", EmitDefaultValue = true, IsRequired = false)]
public string GviOnEdit
{
get
{
string s = (string)ViewState["GviOnEdit"];
return s;
}
set
{
ViewState["GviOnEdit"] = value;
}
}


[GviConfigOption]
[GviEventOption("delete")]
[Bindable(true)]
[Category("Events")]
[Description(@"An event is about to be deleted. Fired after the user clicked the 'Delete Event' button on the right of an event.
The selected row can be retrieved via the method getSelection, and new start and end data can be read in the according row in the data table.
The delete event can be canceled by calling the method cancelDelete from within the event listener.This is useful when deletions need to be approved.")]
[DataMember(Name = "delete", EmitDefaultValue = true, IsRequired = false)]
public string GviOnDelete
{
get
{
string s = (string)ViewState["GviOnDelete"];
return s;
}
set
{
ViewState["GviOnDelete"] = value;
}
}


[GviConfigOption]
[GviEventOption("rangechanged")]
[Bindable(true)]
[Category("Events")]
[Description(@"Visible range has been changed. Fired once after the user has modified the visible time by moving (dragging) the timeline, or by zooming (scrolling), but not after a call to setVisibleChartRange or setRangeToCurrentTime methods. The new range can be retrieved by calling getVisibleChartRange method.")]
[DataMember(Name = "rangechanged", EmitDefaultValue = true, IsRequired = false)]
public string GviOnRangeChanged
{
get
{
string s = (string)ViewState["GviOnRangeChanged"];
return s;
}
set
{
ViewState["GviOnRangeChanged"] = value;
}
}

[GviConfigOption]
[GviEventOption("select")]
[Bindable(true)]
[Category("Events")]
[Description(@"When the user clicks on an event or a cluster on the timeline, the corresponding row in the data table is selected. The visualization then fires this event.
The selected row or cluster can be retrieved via the method getSelection.")]
[DataMember(Name = "select", EmitDefaultValue = true, IsRequired = false)]
public string GviOnSelect
{
get
{
string s = (string)ViewState["GviOnSelect"];
return s;
}
set
{
ViewState["GviOnSelect"] = value;
}
}


[GviConfigOption]
[GviEventOption("timechanged")]
[Bindable(true)]
[Category("Events")]
[Description(@"The custom time bar has been changed. Fired once after the user has dragged the blue custom time bar, but not after a call to the setCustomTime method. The new custom time can be retrieved by calling getCustomTime method.")]
[DataMember(Name = "timechanged", EmitDefaultValue = true, IsRequired = false)]
public string GviOnTimeChanged
{
get
{
string s = (string)ViewState["GviOnTimeChanged"];
return s;
}
set
{
ViewState["GviOnTimeChanged"] = value;
}
}

private DateTime? visibleChartRangeStart
{
get
Expand Down Expand Up @@ -113,21 +259,21 @@ protected override void RenderContents(HtmlTextWriter output)

public override string ToString()
{
//List<Newtonsoft.Json.JsonConverter> myconverters = new List<Newtonsoft.Json.JsonConverter>();
List<Newtonsoft.Json.JsonConverter> myconverters = new List<Newtonsoft.Json.JsonConverter>();
//myconverters.Add(new CustomConvertersColorToRGB());
//myconverters.Add(new CustomConvertersAxis());
//myconverters.Add(new CustomConvertersLegend());
//myconverters.Add(new CustomConverterEnum());
//myconverters.Add(new CustomConverterTrendLine());

//Newtonsoft.Json.JsonSerializerSettings settings = new Newtonsoft.Json.JsonSerializerSettings()
//{
// NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
// Converters = myconverters
//};
Newtonsoft.Json.JsonSerializerSettings settings = new Newtonsoft.Json.JsonSerializerSettings()
{
NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
Converters = myconverters
};

string s = string.Empty;
s = Newtonsoft.Json.JsonConvert.SerializeObject(this.TimelineOptions, Newtonsoft.Json.Formatting.None);
s = Newtonsoft.Json.JsonConvert.SerializeObject(this.TimelineOptions, settings);
return s;
}
}
Expand Down
6 changes: 3 additions & 3 deletions GoogleChartsNGraphsControls/DataStructs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public CHAPTimelineEvent()
this.start = DateTime.MinValue;
this.end = DateTime.MinValue;
this.content = string.Empty;
this.editable = false;
this.editable = true;
this.group = string.Empty;
}
public CHAPTimelineEvent(DateTime start, string content): this()
Expand Down Expand Up @@ -121,11 +121,11 @@ public object[] ToRow()

public class WaterMarkLine : ComboChartLineSeries
{
public WaterMarkLine(System.Drawing.Color color, decimal FixedValueAt)
public WaterMarkLine(System.Drawing.Color color, decimal FixedValueAt, string Title)
{
this.FunctType = FUNCTION_TYPE.FIXED;
this.LineType = GoogleChartsNGraphsControls.SeriesType.Area;
this.LineName = "";
this.LineName = Title;
this.FixedValue = FixedValueAt;
this.LineColor = color;
this.AddOption("opacity", 1.0);
Expand Down
9 changes: 2 additions & 7 deletions GoogleChartsNGraphsControls/GVBarChart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class GVBarChart : BaseWebControl, IsStackable, HasTrendLines
[Category("GoogleOptions")]
[Description(@"If set to true, bar values are stacked (accumulated).")]
[DefaultValue(false)]
[DataMember(Name="isStacked", EmitDefaultValue=true, IsRequired = false)]
[DataMember(Name = "isStacked", EmitDefaultValue = true, IsRequired = false)]
public bool? GviIsStacked
{
get
Expand All @@ -39,18 +39,13 @@ public bool? GviIsStacked
}
}


protected override void RenderContents(HtmlTextWriter output)
{
this.GviTitle = string.IsNullOrEmpty(this.GviTitle) ? this.dt.TableName : this.GviTitle;
this.gvi.RegisterGVIScriptsEx(this, this.dt, BaseGVI.GOOGLECHART.BARCHART);
output.Write(Text);
}
// Support for IPostBackEventHandler
//protected override void Render(HtmlTextWriter output)
//{
// RenderContents(output);
//}

public override string ToString()
{
List<Newtonsoft.Json.JsonConverter> myconverters = new List<Newtonsoft.Json.JsonConverter>();
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
C:\Users\kingj5\Documents\Visual Studio 2010\Projects\googlevisualizationsdotnet\GoogleChartsNGraphsControls\bin\Debug\GoogleChartsNGraphsControls.dll
C:\Users\kingj5\Documents\Visual Studio 2010\Projects\googlevisualizationsdotnet\GoogleChartsNGraphsControls\bin\Debug\GoogleChartsNGraphsControls.pdb
C:\Users\kingj5\Documents\Visual Studio 2010\Projects\googlevisualizationsdotnet\GoogleChartsNGraphsControls\bin\Debug\GoogleChartsNGraphsControls.tlb
C:\Users\kingj5\Documents\Visual Studio 2010\Projects\googlevisualizationsdotnet\GoogleChartsNGraphsControls\bin\Debug\Newtonsoft.Json.dll
C:\Users\kingj5\Documents\Visual Studio 2010\Projects\googlevisualizationsdotnet\GoogleChartsNGraphsControls\bin\Debug\Visualization.dll
C:\Users\kingj5\Documents\Visual Studio 2010\Projects\googlevisualizationsdotnet\GoogleChartsNGraphsControls\bin\Debug\Visualization.pdb
C:\Users\kingj5\Documents\Visual Studio 2010\Projects\googlevisualizationsdotnet\GoogleChartsNGraphsControls\obj\Debug\GoogleChartsNGraphsControls.csprojResolveAssemblyReference.cache
C:\Users\kingj5\Documents\Visual Studio 2010\Projects\googlevisualizationsdotnet\GoogleChartsNGraphsControls\obj\Debug\GoogleChartsNGraphsControls.Resource1.resources
C:\Users\kingj5\Documents\Visual Studio 2010\Projects\googlevisualizationsdotnet\GoogleChartsNGraphsControls\obj\Debug\GoogleChartsNGraphsControls.csproj.GenerateResource.Cache
C:\Users\kingj5\Documents\Visual Studio 2010\Projects\googlevisualizationsdotnet\GoogleChartsNGraphsControls\obj\Debug\GoogleChartsNGraphsControls.dll
C:\Users\kingj5\Documents\Visual Studio 2010\Projects\googlevisualizationsdotnet\GoogleChartsNGraphsControls\obj\Debug\GoogleChartsNGraphsControls.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
C:\Users\kingj5\Documents\Visual Studio 2010\Projects\googlevisualizationsdotnet\GoogleChartsNGraphsControls\bin\Release\GoogleChartsNGraphsControls.dll
C:\Users\kingj5\Documents\Visual Studio 2010\Projects\googlevisualizationsdotnet\GoogleChartsNGraphsControls\bin\Release\GoogleChartsNGraphsControls.pdb
C:\Users\kingj5\Documents\Visual Studio 2010\Projects\googlevisualizationsdotnet\GoogleChartsNGraphsControls\bin\Release\Newtonsoft.Json.dll
C:\Users\kingj5\Documents\Visual Studio 2010\Projects\googlevisualizationsdotnet\GoogleChartsNGraphsControls\bin\Release\Visualization.dll
C:\Users\kingj5\Documents\Visual Studio 2010\Projects\googlevisualizationsdotnet\GoogleChartsNGraphsControls\bin\Release\Visualization.pdb
C:\Users\kingj5\Documents\Visual Studio 2010\Projects\googlevisualizationsdotnet\GoogleChartsNGraphsControls\obj\Release\GoogleChartsNGraphsControls.csprojResolveAssemblyReference.cache
C:\Users\kingj5\Documents\Visual Studio 2010\Projects\googlevisualizationsdotnet\GoogleChartsNGraphsControls\obj\Release\GoogleChartsNGraphsControls.Resource1.resources
C:\Users\kingj5\Documents\Visual Studio 2010\Projects\googlevisualizationsdotnet\GoogleChartsNGraphsControls\obj\Release\GoogleChartsNGraphsControls.csproj.GenerateResource.Cache
C:\Users\kingj5\Documents\Visual Studio 2010\Projects\googlevisualizationsdotnet\GoogleChartsNGraphsControls\obj\Release\GoogleChartsNGraphsControls.dll
C:\Users\kingj5\Documents\Visual Studio 2010\Projects\googlevisualizationsdotnet\GoogleChartsNGraphsControls\obj\Release\GoogleChartsNGraphsControls.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
17 changes: 16 additions & 1 deletion TestGoogleCharsNGraphsControls/CHAP.aspx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,26 @@
<style type="text/css">
</style>
<script type="text/javascript">
function onSelection(chart) {
if (chart != undefined && chart.getSelection() != undefined) {
alert(chart.getSelection()[0].row);
}
}
function onChangeOfRange(chart) {
if (chart != undefined)
{
var newRange = chart.getVisibleChartRange();
alert("From " + newRange.start +" to "+newRange.end)
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<h3>CHAP Timeline implementation</h3>
<cc1:CHAPTimeline ID="CHAPTimeline1" runat="server" Width="900" Height="220" />
<cc1:CHAPTimeline ID="CHAPTimeline1" runat="server" Width="900" Height="220" GviOnSelect="onSelection" GviOnRangeChanged="onChangeOfRange" />
</form>
</body>
</html>
6 changes: 6 additions & 0 deletions TestGoogleCharsNGraphsControls/CHAP.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ private void ChapTimeline()
lst.Add(new GoogleChartsNGraphsControls.CHAPTimelineEvent(new DateTime(2015, 7, 22), new DateTime(2015, 7, 23), "Watched TV"));
lst.Add(new GoogleChartsNGraphsControls.CHAPTimelineEvent(new DateTime(2015, 7, 27), "Bed Time!"));

//this.CHAPTimeline1.GviOnSelect = "onSelection";
this.CHAPTimeline1.ChartData(lst.ToArray());

this.CHAPTimeline1.TimelineOptions = new GoogleChartsNGraphsControls.CHAPTimelineOptions()
{
Editable = true
};
}
}
}
Loading

0 comments on commit d403b5d

Please sign in to comment.