void TwoSetVennInteractivity(NVennSeries venn) { int[] arrContourIds; NInteractivityStyle interactivity; // set the default tooltip venn.InteractivityStyle.Tooltip.Text = "Venn Diagram"; venn.InteractivityStyle.Cursor.Type = CursorType.No; // clear previous interactivity objects venn.ClearSegmentInteractivityStyles(); // Set tooltips and cursors for particular segments arrContourIds = new int[] { 0 }; interactivity = new NInteractivityStyle(); interactivity.Tooltip.Text = "Segment A"; venn.SetInteractivityForSegment(arrContourIds, interactivity); arrContourIds = new int[] { 1 }; interactivity = new NInteractivityStyle(); interactivity.Tooltip.Text = "Segment B"; venn.SetInteractivityForSegment(arrContourIds, interactivity); arrContourIds = new int[] { 0, 1 }; interactivity = new NInteractivityStyle(); interactivity.Tooltip.Text = "Segment AB"; venn.SetInteractivityForSegment(arrContourIds, interactivity); }
private NInteractivityStyle CreateInteractivityStyle(string shapeName) { NInteractivityStyle interactivityStyle = new NInteractivityStyle(); string script = "alert(\"Mouse Event [" + CaptureMouseEventDropDownList.SelectedValue.ToString() + "]. Captured for bar [" + shapeName + "])\");"; switch (CaptureMouseEventDropDownList.SelectedIndex) { case 0: // Mouse down interactivityStyle.ClientMouseEventAttribute.MouseDown = script; break; case 1: // Mouse up interactivityStyle.ClientMouseEventAttribute.MouseUp = script; break; case 2: // Click interactivityStyle.ClientMouseEventAttribute.Click = script; break; case 3: // Double clicks interactivityStyle.ClientMouseEventAttribute.DoubleClick = script; break; case 4: // MouseEnter interactivityStyle.ClientMouseEventAttribute.MouseEnter = script; break; case 5: // MouseLeave interactivityStyle.ClientMouseEventAttribute.MouseLeave = script; break; } return(interactivityStyle); }
private void GenerateXYData(NPointSeries series) { for (int i = 0; i < 200; i++) { double u1 = Random.NextDouble(); double u2 = Random.NextDouble(); if (u1 == 0) { u1 += 0.0001; } if (u2 == 0) { u2 += 0.0001; } double z0 = Math.Sqrt(-2 * Math.Log(u1)) * Math.Cos(2 * Math.PI * u2); double z1 = Math.Sqrt(-2 * Math.Log(u1)) * Math.Sin(2 * Math.PI * u2); series.XValues.Add(z0); series.Values.Add(z1); NInteractivityStyle interactivity = new NInteractivityStyle("X: " + z0.ToString("0.00") + ", Y:" + z1.ToString("0.00"), CursorType.Hand); series.InteractivityStyles.Add(i, interactivity); } }
private NInteractivityStyle CreateInteractivityStyle(string text) { NInteractivityStyle interactivityStyle = new NInteractivityStyle(); interactivityStyle.Tooltip.Text = text; interactivityStyle.Cursor = new NCursorAttribute(CursorType.Hand); return(interactivityStyle); }
private NInteractivityStyle CreateInteractivityStyle(string shapeName, string url) { NInteractivityStyle interactivityStyle = new NInteractivityStyle(); interactivityStyle.Tooltip.Text = shapeName; interactivityStyle.UrlLink.Url = url; interactivityStyle.Cursor.Type = CursorType.Hand; return(interactivityStyle); }
public override bool OnPolygonCreated(NDiagramElement element, NMapFeature mapFeature) { NShape shape = element as NShape; if (shape != null) { NInteractivityStyle iStyle = new NInteractivityStyle(true, null, mapFeature.GetAttributeValue(m_sTooltipColumnName).ToString()); NStyle.SetInteractivityStyle(shape, iStyle); } return(base.OnPolygonCreated(element, mapFeature)); }
private void CreateScene(NDrawingDocument document) { // Initialize the default document style document.BackgroundStyle.FrameStyle.Visible = false; document.Style.StartArrowheadStyle.Shape = ArrowheadShape.None; document.Style.EndArrowheadStyle.Shape = ArrowheadShape.None; document.Style.FillStyle = new NGradientFillStyle(GradientStyle.DiagonalUp, GradientVariant.Variant1, new NArgbColor(155, 184, 209), new NArgbColor(83, 138, 179)); NDrawingDocumentHelper helper = new NDrawingDocumentHelper(document); // Create the shapes NShape vision = helper.CreateBasicShape(BasicShapes.Rectangle, new NRectangleF(0, 0, 100, 50), "Nevron Vision", String.Empty); NInteractivityStyle iStyle = new NInteractivityStyle(); iStyle.UrlLink = new NUrlLinkAttribute("http://www.nevron.com", true); NStyle.SetInteractivityStyle(vision, iStyle); NShape chart = helper.CreateBasicShape(BasicShapes.Rectangle, new NRectangleF(0, 0, 100, 50), "Nevron Chart", String.Empty); iStyle = new NInteractivityStyle(); iStyle.UrlLink = new NUrlLinkAttribute("http://nevron.com/Products.ChartFor.NET.Overview.aspx", true); NStyle.SetInteractivityStyle(chart, iStyle); NShape diagram = helper.CreateBasicShape(BasicShapes.Rectangle, new NRectangleF(0, 0, 100, 50), "Nevron Diagram", String.Empty); iStyle = new NInteractivityStyle(); iStyle.UrlLink = new NUrlLinkAttribute("http://nevron.com/Products.DiagramFor.NET.Overview.aspx", true); NStyle.SetInteractivityStyle(diagram, iStyle); NShape ui = helper.CreateBasicShape(BasicShapes.Rectangle, new NRectangleF(0, 0, 100, 50), "Nevron User Interface", String.Empty); iStyle = new NInteractivityStyle(); iStyle.UrlLink = new NUrlLinkAttribute("http://nevron.com/Products.UserInterfaceFor.NET.Overview.aspx", true); NStyle.SetInteractivityStyle(ui, iStyle); // Create the connectors Connect(vision, chart); Connect(vision, diagram); Connect(vision, ui); // Layout the shapes NLayeredGraphLayout layout = new NLayeredGraphLayout(); layout.Direction = LayoutDirection.LeftToRight; NNodeList shapes = document.ActiveLayer.Children(null); layout.Layout(shapes, new NDrawingLayoutContext(document)); }
void AddDataPoint(NOrdinalScaleConfigurator scale, NBarSeries bar, double value, string countryName, string url) { scale.Labels.Add(countryName); bar.Values.Add(value); bar.Labels.Add(countryName); NInteractivityStyle interactivityStyle = new NInteractivityStyle(); interactivityStyle.Tooltip = new NTooltipAttribute("Click here to jump to [" + countryName + "]"); interactivityStyle.Cursor = new NCursorAttribute(CursorType.Hand); interactivityStyle.UrlLink = new NUrlLinkAttribute(url, true); bar.InteractivityStyles.Add(bar.Values.Count - 1, interactivityStyle); }
public override bool OnPolygonCreated(NDiagramElement element, NMapFeature mapFeature) { NShape shape = element as NShape; if (shape == null) { return(true); } string name = mapFeature.GetAttributeValue("CNTRY_NAME").ToString(); decimal sales = (decimal)mapFeature.GetAttributeValue("Sales"); NInteractivityStyle interactivityStyle = new NInteractivityStyle(String.Format("Sales value in {0}: {1:N0} million dollars", name, sales)); shape.Style.InteractivityStyle = interactivityStyle; return(true); }
public override bool OnPolygonCreated(NDiagramElement element, NMapFeature mapFeature) { NShape shape = element as NShape; if (shape == null) { return(true); } string name = mapFeature.GetAttributeValue("CNTRY_NAME").ToString(); int population = Int32.Parse(mapFeature.GetAttributeValue("POP_CNTRY").ToString()); NInteractivityStyle interactivityStyle = new NInteractivityStyle(String.Format("{0}'{1} population: {2:N0}", name, name.EndsWith("s") ? String.Empty : "s", population)); NStyle.SetInteractivityStyle(shape, interactivityStyle); return(true); }
public override bool OnPolygonCreated(NDiagramElement element, NMapFeature mapFeature) { NShape shape = element as NShape; if (shape == null) { return(true); } string name = mapFeature.GetAttributeValue("CNTRY_NAME").ToString(); float population = Single.Parse(mapFeature.GetAttributeValue("POP_CNTRY").ToString()); float landArea = Single.Parse(mapFeature.GetAttributeValue("SQKM").ToString()); // add a tooltip to the shape NInteractivityStyle interactivityStyle = new NInteractivityStyle( string.Format("{1}{0}======================{0}Land Area: {2:N} km2{0}Population: {3:N0} people{0}Pop. Density: {4:N} people/km2", Environment.NewLine, name, landArea, population, population / landArea)); shape.Style.InteractivityStyle = interactivityStyle; return(true); }
protected void ApplyImageMapAttributesToSerie(NPieSeries pie) { String sCustomAttribute, sFader; NInteractivityStyle interactivityStyle; for (int i = 0; i < pie.Values.Count; i++) { sFader = "bus"; switch (i) { case 0: sFader = "car"; break; case 1: sFader = "train"; break; case 2: sFader = "ship"; break; case 3: sFader = "bus"; break; } sCustomAttribute = "#default_mouse_click #default_mouse_move #default_title onMouseOver=\"JSFX.fadeIn('" + sFader + "')\" onMouseOut=\"JSFX.fadeOut('" + sFader + "')\""; interactivityStyle = new NInteractivityStyle(); interactivityStyle.CustomMapAreaAttribute.JScriptAttribute = sCustomAttribute; interactivityStyle.GeneratePostback = true; pie.InteractivityStyles[i] = interactivityStyle; } }
private void UpdateControls(bool bSave) { if (m_bUpdating == true) { return; } m_bUpdating = true; NInteractivityStyle interactivityStyle = GetCurrentInteractivityStyle(); if (bSave) { interactivityStyle.Tooltip.Text = TooltipTextBox.Text; interactivityStyle.Cursor.Type = (CursorType)(CursorComboBox.SelectedIndex); } else { TooltipTextBox.Text = interactivityStyle.Tooltip.Text; CursorComboBox.SelectedIndex = (int)(interactivityStyle.Cursor.Type); } m_bUpdating = false; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { CaptureMouseEventDropDownList.Items.Add("OnClick"); CaptureMouseEventDropDownList.Items.Add("OnDblClick"); CaptureMouseEventDropDownList.Items.Add("OnMouseEnter"); CaptureMouseEventDropDownList.Items.Add("OnMouseLeave"); CaptureMouseEventDropDownList.Items.Add("Postback"); CaptureMouseEventDropDownList.SelectedIndex = 0; } NBarSeries bar; if (!NThinChartControl1.Initialized) { NThinChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel header = NThinChartControl1.Labels.AddHeader("Client Side Events Tool"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL( new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // configure the legend NLegend legend = NThinChartControl1.Legends[0]; legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Right); legend.FillStyle.SetTransparencyPercent(50); legend.Location = new NPointL(new NLength(98, NRelativeUnit.ParentPercentage), legend.Location.Y); // configure the chart NChart chart = NThinChartControl1.Charts[0]; chart.Axis(StandardAxis.Depth).Visible = false; chart.BoundsMode = BoundsMode.Fit; chart.Location = new NPointL(new NLength(5, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL(new NLength(70, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage)); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft); // create a bar series bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.Name = "My Bar Series"; bar.DataLabelStyle.Format = "<value>"; bar.AddDataPoint(new NDataPoint(10, "Ford", new NColorFillStyle(WebExamplesUtilities.RandomColor()))); bar.AddDataPoint(new NDataPoint(20, "Toyota", new NColorFillStyle(WebExamplesUtilities.RandomColor()))); bar.AddDataPoint(new NDataPoint(30, "VW", new NColorFillStyle(WebExamplesUtilities.RandomColor()))); bar.AddDataPoint(new NDataPoint(25, "Mitsubishi", new NColorFillStyle(WebExamplesUtilities.RandomColor()))); bar.AddDataPoint(new NDataPoint(29, "Jaguar", new NColorFillStyle(WebExamplesUtilities.RandomColor()))); bar.Legend.Mode = SeriesLegendMode.DataPoints; bar.BarShape = BarShape.SmoothEdgeBar; bar.DataLabelStyle.Visible = false; NThinChartControl1.Controller.Tools.Add(new NClientMouseEventTool()); } else { bar = (NBarSeries)(NThinChartControl1.Charts[0].Series[0]); } bar.InteractivityStyles.Clear(); for (int i = 0; i < bar.Values.Count; i++) { NInteractivityStyle interactivityStyle = new NInteractivityStyle(); string script = "alert(\"Mouse Event [" + CaptureMouseEventDropDownList.SelectedValue.ToString() + "]. Captured for bar [" + i.ToString() + "])\");"; switch (CaptureMouseEventDropDownList.SelectedIndex) { case 0: // OnClick interactivityStyle.ClientMouseEventAttribute.Click = script; break; case 1: // OnDblClick interactivityStyle.ClientMouseEventAttribute.DoubleClick = script; break; case 2: // OnMouseEnter interactivityStyle.ClientMouseEventAttribute.MouseEnter = script; break; case 3: // OnMouseLeave interactivityStyle.ClientMouseEventAttribute.MouseLeave = script; break; case 4: interactivityStyle.ClientMouseEventAttribute.Click = "_doPostback()"; break; } bar.InteractivityStyles[i] = interactivityStyle; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { CaptureMouseEventDropDownList.Items.Add("OnClick"); CaptureMouseEventDropDownList.Items.Add("OnDblClick"); CaptureMouseEventDropDownList.Items.Add("OnMouseOut"); CaptureMouseEventDropDownList.Items.Add("OnMouseOver"); CaptureMouseEventDropDownList.Items.Add("OnMouseWheel"); CaptureMouseEventDropDownList.SelectedIndex = 0; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel header = nChartControl1.Labels.AddHeader("Capturing Mouse Events"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL( new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // configure the legend NLegend legend = nChartControl1.Legends[0]; legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Right); legend.FillStyle.SetTransparencyPercent(50); legend.Location = new NPointL(new NLength(98, NRelativeUnit.ParentPercentage), legend.Location.Y); // configure the chart NChart chart = nChartControl1.Charts[0]; chart.Axis(StandardAxis.Depth).Visible = false; chart.BoundsMode = BoundsMode.Fit; chart.Location = new NPointL(new NLength(5, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL(new NLength(70, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage)); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft); // create a bar series NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.Name = "My Bar Series"; bar.DataLabelStyle.Format = "<value>"; bar.AddDataPoint(new NDataPoint(10, "Ford", new NColorFillStyle(WebExamplesUtilities.RandomColor()))); bar.AddDataPoint(new NDataPoint(20, "Toyota", new NColorFillStyle(WebExamplesUtilities.RandomColor()))); bar.AddDataPoint(new NDataPoint(30, "VW", new NColorFillStyle(WebExamplesUtilities.RandomColor()))); bar.AddDataPoint(new NDataPoint(25, "Mitsubishi", new NColorFillStyle(WebExamplesUtilities.RandomColor()))); bar.AddDataPoint(new NDataPoint(29, "Jaguar", new NColorFillStyle(WebExamplesUtilities.RandomColor()))); bar.Legend.Mode = SeriesLegendMode.DataPoints; bar.BarShape = BarShape.SmoothEdgeBar; bar.DataLabelStyle.Visible = false; for (int i = 0; i < bar.Values.Count; i++) { string customAttribute = CaptureMouseEventDropDownList.SelectedItem.Text + " = \"javascript:alert(' Mouse event [" + CaptureMouseEventDropDownList.SelectedItem.Text + "] intercepted for bar [" + i.ToString() + "] ')\" "; NInteractivityStyle interactivityStyle = new NInteractivityStyle(); interactivityStyle.CustomMapAreaAttribute.JScriptAttribute = customAttribute; bar.InteractivityStyles[i] = interactivityStyle; } // change the response type to image map NHtmlImageMapResponse imageMapResponse = new NHtmlImageMapResponse(); nChartControl1.ServerSettings.BrowserResponseSettings.DefaultResponse = imageMapResponse; }
protected NCompositeShape CreateOrgChartShape(NPersonalInfo info) { NRectangleF bounds = info.Bounds; float bottomPortAlignment = info.BottomPortAlignment; Bitmap photo = new Bitmap(this.MapPathSecure(info.Picture)); // compose a new graph vertex from a frame and an image NRectanglePath frame = new NRectanglePath(bounds); NRectanglePath image = new NRectanglePath(new NPointF(bounds.X + 5, bounds.Y + 5), new NSizeF(photo.Size)); NImageFillStyle imgageFillStyle = new NImageFillStyle(photo, 0xff); NStyle.SetFillStyle(image, imgageFillStyle); NCompositeShape shape = new NCompositeShape(); shape.Primitives.AddChild(frame); shape.Primitives.AddChild(image); shape.UpdateModelBounds(); Document.ActiveLayer.AddChild(shape); // set the vertex fill style NColorFillStyle fillStyle = null; switch (info.Level) { case 0: fillStyle = new NColorFillStyle(Color.FromArgb(241, 100, 34)); break; case 1: fillStyle = new NColorFillStyle(Color.FromArgb(249, 167, 26)); break; case 2: fillStyle = new NColorFillStyle(Color.FromArgb(255, 247, 151)); break; } fillStyle.ImageFiltersStyle.Filters.Add(new NLightingImageFilter()); shape.Style.FillStyle = fillStyle; NInteractivityStyle interactivityStyle = new NInteractivityStyle(); interactivityStyle.Tooltip.Text = "Click to show " + info.Name + " personal information"; interactivityStyle.UrlLink.Url = "../Examples/WebControl/GettingStarted/NPersonalInfoPage.aspx?" + info.Id.ToString(); shape.Style.InteractivityStyle = interactivityStyle; // add a new label for the person name NRotatedBoundsLabel nameLabel = new NRotatedBoundsLabel(info.Name, shape.UniqueId, new Nevron.Diagram.NMargins(40, 1, 50, 1)); shape.Labels.AddChild(nameLabel); NStyle.SetTextStyle(nameLabel, nameLabel.ComposeTextStyle().Clone() as NTextStyle); nameLabel.Style.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Right; nameLabel.Style.TextStyle.StringFormatStyle.VertAlign = VertAlign.Top; // configure default label (used for the person position) NRotatedBoundsLabel positionLabel = shape.Labels.DefaultLabel as NRotatedBoundsLabel; NStyle.SetTextStyle(positionLabel, positionLabel.ComposeTextStyle().Clone() as NTextStyle); positionLabel.Style.TextStyle.FontStyle.InitFromFont(new Font("Arial", 10, FontStyle.Bold)); positionLabel.Style.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Right; positionLabel.Style.TextStyle.StringFormatStyle.VertAlign = VertAlign.Bottom; positionLabel.Margins = new Nevron.Diagram.NMargins(40, 5, 1, 50); positionLabel.Text = info.Position; // create the optional ports of the shape shape.CreateShapeElements(ShapeElementsMask.Ports); // add rotated bounds ports NPort leftPort = new NRotatedBoundsPort(shape.UniqueId, new NContentAlignment(ContentAlignment.MiddleLeft)); leftPort.Name = "Left"; shape.Ports.AddChild(leftPort); NPort rightPort = new NRotatedBoundsPort(shape.UniqueId, new NContentAlignment(ContentAlignment.MiddleRight)); rightPort.Name = "Right"; shape.Ports.AddChild(rightPort); NPort topPort = new NRotatedBoundsPort(shape.UniqueId, new NContentAlignment(ContentAlignment.TopCenter)); topPort.Name = "Top"; shape.Ports.AddChild(topPort); NRotatedBoundsPort bottomPort = new NRotatedBoundsPort(shape.UniqueId, new NContentAlignment(bottomPortAlignment, 50)); bottomPort.Name = "Bottom"; shape.Ports.AddChild(bottomPort); return(shape); }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; NChart chart; NBarSeries bar; nChartControl1.Legends[0].SetPredefinedLegendStyle(PredefinedLegendStyle.Bottom); chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Fit; chart.Location = new NPointL(new NLength(20, NRelativeUnit.ParentPercentage), new NLength(20, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL(new NLength(60, NRelativeUnit.ParentPercentage), new NLength(60, NRelativeUnit.ParentPercentage)); chart.Depth = 20; bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.AddDataPoint(new NDataPoint(100 + Random.Next(100), "Toyota", new NColorFillStyle(Color.Red))); bar.AddDataPoint(new NDataPoint(100 + Random.Next(100), "Volkswagen", new NColorFillStyle(Color.Gold))); bar.AddDataPoint(new NDataPoint(100 + Random.Next(100), "Ford", new NColorFillStyle(Color.Chocolate))); bar.AddDataPoint(new NDataPoint(100 + Random.Next(100), "Mazda", new NColorFillStyle(Color.LimeGreen))); bar.Legend.Mode = SeriesLegendMode.DataPoints; bar.Legend.Format = "<label>"; // add urls to redirect to NInteractivityStyle interactivityStyle = new NInteractivityStyle("Click here to jump to Toyota home page", CursorType.Hand); interactivityStyle.UrlLink.Url = "http://www.toyota.com"; interactivityStyle.UrlLink.OpenInNewWindow = OpenLinkInNewWindowCheckBox.Checked; bar.InteractivityStyles.Add(0, interactivityStyle); interactivityStyle = new NInteractivityStyle("Click here to jump to VW home page", CursorType.Hand); interactivityStyle.UrlLink.Url = "http://www.vw.com"; interactivityStyle.UrlLink.OpenInNewWindow = OpenLinkInNewWindowCheckBox.Checked; bar.InteractivityStyles.Add(1, interactivityStyle); interactivityStyle = new NInteractivityStyle("Click here to jump to Ford home page", CursorType.Hand); interactivityStyle.UrlLink.Url = "http://www.ford.com"; interactivityStyle.UrlLink.OpenInNewWindow = OpenLinkInNewWindowCheckBox.Checked; bar.InteractivityStyles.Add(2, interactivityStyle); interactivityStyle = new NInteractivityStyle("Click here to jump to Mazda home page", CursorType.Hand); interactivityStyle.UrlLink.Url = "http://www.mazda.com"; interactivityStyle.UrlLink.OpenInNewWindow = OpenLinkInNewWindowCheckBox.Checked; bar.InteractivityStyles.Add(3, interactivityStyle); for (int i = 0; i < bar.Values.Count; i++) { bar.FillStyles[i] = new NColorFillStyle(WebExamplesUtilities.RandomColor()); } chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.NorthernLights); chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); // add header NLabel header = nChartControl1.Labels.AddHeader("Car Sales per Company<br/><font size = '10'>Demonstrates anchor SVG tags</font>"); header.TextStyle.BackplaneStyle.Visible = false; header.TextStyle.TextFormat = TextFormat.XML; header.TextStyle.FillStyle = new NColorFillStyle(Color.Black); header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); NImageResponse imageResponse = new NImageResponse(); NSvgImageFormat svgImageFormat = new NSvgImageFormat(); svgImageFormat.EnableInteractivity = true; svgImageFormat.CustomScript = ""; imageResponse.ImageFormat = svgImageFormat; nChartControl1.ServerSettings.BrowserResponseSettings.DefaultResponse = imageResponse; }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; NHtmlImageMapResponse imageMapResponse = new NHtmlImageMapResponse(); nChartControl1.ServerSettings.BrowserResponseSettings.DefaultResponse = imageMapResponse; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("HTML Image Map"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // setup the chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); chart.Axis(StandardAxis.Depth).Visible = false; // add a bar series NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.DataLabelStyle.Visible = false; bar.Legend.Mode = SeriesLegendMode.DataPoints; bar.Legend.Format = "<label> <percent>"; bar.AddDataPoint(new NDataPoint(12, "Cars")); bar.AddDataPoint(new NDataPoint(42, "Trains")); bar.AddDataPoint(new NDataPoint(56, "Buses")); bar.AddDataPoint(new NDataPoint(23, "Ships")); // modify the axis labels NOrdinalScaleConfigurator ordinalScale = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; ordinalScale.AutoLabels = false; for (int i = 0; i < bar.Labels.Count; i++) { ordinalScale.Labels.Add((string)bar.Labels[i]); } // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.PaleMultiColor); styleSheet.Apply(chart); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); // add interactivity styles with the urls to redirect to and the corresponding cursors and tooltips NInteractivityStyle interactivityStyle = new NInteractivityStyle("Click here to jump to Cars sales page", CursorType.Hand); interactivityStyle.UrlLink.OpenInNewWindow = true; interactivityStyle.UrlLink.Url = "../Examples/GettingStarted/NCarSalesPage.aspx"; bar.InteractivityStyles[0] = interactivityStyle; interactivityStyle = new NInteractivityStyle("Click here to jump to Trains sales page", CursorType.Hand); interactivityStyle.UrlLink.OpenInNewWindow = true; interactivityStyle.UrlLink.Url = "../Examples/GettingStarted/NTrainSalesPage.aspx"; bar.InteractivityStyles[1] = interactivityStyle; interactivityStyle = new NInteractivityStyle("Click here to jump to Bus sales page", CursorType.Hand); interactivityStyle.UrlLink.OpenInNewWindow = true; interactivityStyle.UrlLink.Url = "../Examples/GettingStarted/NBusSalesPage.aspx"; bar.InteractivityStyles[2] = interactivityStyle; interactivityStyle = new NInteractivityStyle("Click here to jump to Ship sales page", CursorType.Hand); interactivityStyle.UrlLink.OpenInNewWindow = true; interactivityStyle.UrlLink.Url = "../Examples/GettingStarted/NShipSalesPage.aspx"; bar.InteractivityStyles[3] = interactivityStyle; }
private NInteractivityStyle GetCurrentInteractivityStyle() { NInteractivityStyle interactivityStyle = null; switch (ChartObjectComboBox.SelectedIndex) { // Background case 0: interactivityStyle = nChartControl1.InteractivityStyle; break; // Back chart wall case 1: interactivityStyle = m_Chart.Wall(ChartWallType.Back).InteractivityStyle; break; // Left chart wall case 2: interactivityStyle = m_Chart.Wall(ChartWallType.Left).InteractivityStyle; break; /// Floor chart wall case 3: interactivityStyle = m_Chart.Wall(ChartWallType.Floor).InteractivityStyle; break; // Primary Y axis case 4: interactivityStyle = m_Chart.Axis(StandardAxis.PrimaryY).InteractivityStyle; break; // Primary X axis case 5: interactivityStyle = m_Chart.Axis(StandardAxis.PrimaryX).InteractivityStyle; break; // Horizontal stripe case 6: interactivityStyle = ((NAxisStripe)(m_Chart.Axis(StandardAxis.PrimaryY).Stripes[0])).InteractivityStyle; break; // Vertical stripe case 7: interactivityStyle = ((NAxisStripe)(m_Chart.Axis(StandardAxis.PrimaryX).Stripes[0])).InteractivityStyle; break; // Legend case 8: interactivityStyle = ((NLegend)(nChartControl1.Legends[0])).InteractivityStyle; break; case 9: case 10: case 11: case 12: case 13: NSeries series = (NSeries)m_Chart.Series[0]; interactivityStyle = (NInteractivityStyle)(series.InteractivityStyles[ChartObjectComboBox.SelectedIndex - 9]); break; } return(interactivityStyle); }
public override void Initialize(NThinChartControl control) { NBarSeries bar; control.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel header = control.Labels.AddHeader("Capturing Mouse Events"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL( new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // configure the legend NLegend legend = control.Legends[0]; legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Right); legend.FillStyle.SetTransparencyPercent(50); legend.Location = new NPointL(new NLength(98, NRelativeUnit.ParentPercentage), legend.Location.Y); // configure the chart NChart chart = control.Charts[0]; chart.Axis(StandardAxis.Depth).Visible = false; chart.BoundsMode = BoundsMode.Fit; chart.Location = new NPointL(new NLength(5, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL(new NLength(70, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage)); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft); // create a bar series bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.Name = "My Bar Series"; bar.DataLabelStyle.Format = "<value>"; bar.AddDataPoint(new NDataPoint(10, "Ford", new NColorFillStyle(RandomColor()))); bar.AddDataPoint(new NDataPoint(20, "Toyota", new NColorFillStyle(RandomColor()))); bar.AddDataPoint(new NDataPoint(30, "VW", new NColorFillStyle(RandomColor()))); bar.AddDataPoint(new NDataPoint(25, "Mitsubishi", new NColorFillStyle(RandomColor()))); bar.AddDataPoint(new NDataPoint(29, "Jaguar", new NColorFillStyle(RandomColor()))); bar.Legend.Mode = SeriesLegendMode.DataPoints; bar.BarShape = BarShape.SmoothEdgeBar; bar.DataLabelStyle.Visible = false; control.Controller.Tools.Add(new NClientMouseEventTool()); bar.InteractivityStyles.Clear(); for (int i = 0; i < bar.Values.Count; i++) { NInteractivityStyle interactivityStyle = new NInteractivityStyle(); string script = "alert(\"Mouse Event [Mouse Click]. Captured for bar [" + i.ToString() + "])\");"; interactivityStyle.ClientMouseEventAttribute.Click = script; bar.InteractivityStyles[i] = interactivityStyle; } }
public override void Initialize(NThinChartControl control) { // enable jittering (full scene antialiasing) control.BackgroundStyle.FrameStyle.Visible = false; control.Settings.JitterMode = JitterMode.Enabled; // set a chart title NLabel title = control.Labels.AddHeader("Interactivity Tools<br/>Tooltip, Browser Redirect, Cursor Change"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; title.TextStyle.TextFormat = TextFormat.XML; // setup the chart NChart chart = control.Charts[0]; chart.Enable3D = true; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); chart.Axis(StandardAxis.Depth).Visible = false; // add a bar series NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.DataLabelStyle.Visible = false; bar.Legend.Mode = SeriesLegendMode.DataPoints; bar.Legend.Format = "<label> <percent>"; bar.AddDataPoint(new NDataPoint(42, "Chart")); bar.AddDataPoint(new NDataPoint(56, "Diagram")); bar.AddDataPoint(new NDataPoint(12, "Gauges")); bar.AddDataPoint(new NDataPoint(23, "Maps")); // modify the axis labels NOrdinalScaleConfigurator ordinalScale = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; ordinalScale.AutoLabels = false; for (int i = 0; i < bar.Labels.Count; i++) { ordinalScale.Labels.Add((string)bar.Labels[i]); } // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.PaleMultiColor); styleSheet.Apply(chart); // apply layout ApplyLayoutTemplate(0, control, chart, title, control.Legends[0]); // add interactivity styles with the urls to redirect to and the corresponding cursors and tooltips NInteractivityStyle interactivityStyle = new NInteractivityStyle("Click here to jump to Chart Gallery", CursorType.Hand); interactivityStyle.UrlLink.OpenInNewWindow = true; interactivityStyle.UrlLink.Url = "http://www.nevron.com/Gallery.ChartFor.NET.ChartTypes.BarChartGallery.aspx"; bar.InteractivityStyles[0] = interactivityStyle; interactivityStyle = new NInteractivityStyle("Click here to jump to Diagram Gallery", CursorType.Hand); interactivityStyle.UrlLink.OpenInNewWindow = true; interactivityStyle.UrlLink.Url = "http://www.nevron.com/Gallery.DiagramFor.NET.FlowAndOrganizationCharts.Flowcharts.aspx"; bar.InteractivityStyles[1] = interactivityStyle; interactivityStyle = new NInteractivityStyle("Click here to jump to Gauge Gallery", CursorType.Hand); interactivityStyle.UrlLink.OpenInNewWindow = true; interactivityStyle.UrlLink.Url = "http://www.nevron.com/Gallery.ChartFor.NET.Gauges.RadialGaugeGallery.aspx"; bar.InteractivityStyles[2] = interactivityStyle; interactivityStyle = new NInteractivityStyle("Click here to jump to Maps Gallery", CursorType.Hand); interactivityStyle.UrlLink.OpenInNewWindow = true; interactivityStyle.UrlLink.Url = "http://www.nevron.com/Gallery.DiagramFor.NET.Maps.MapProjections.aspx"; bar.InteractivityStyles[3] = interactivityStyle; control.Controller.Tools.Add(new NTooltipTool()); control.Controller.Tools.Add(new NBrowserRedirectTool()); control.Controller.Tools.Add(new NCursorTool()); control.Controller.Tools.Clear(); // add browser redirect tool control.Controller.Tools.Add(new NBrowserRedirectTool()); // add tooltip tool that follows the mouse NTooltipTool tooltipTool = new NTooltipTool(); tooltipTool.FollowMouse = true; control.Controller.Tools.Add(tooltipTool); // add a cursor change tool control.Controller.Tools.Add(new NCursorTool()); }
public override void Initialize(NThinChartControl control) { control.BackgroundStyle.FrameStyle.Visible = false; control.Panels.Clear(); // set a chart title NLabel header = new NLabel("Indicator Drag Tool"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL(new NLength(3, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); control.Panels.Add(header); // create the radial gauge NRadialGaugePanel m_RadialGauge = new NRadialGaugePanel(); m_RadialGauge.BorderStyle = new NEdgeBorderStyle(BorderShape.Auto); m_RadialGauge.PaintEffect = new NGlassEffectStyle(); m_RadialGauge.ContentAlignment = ContentAlignment.MiddleCenter; m_RadialGauge.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(52, NRelativeUnit.ParentPercentage)); m_RadialGauge.Size = new NSizeL(new NLength(90, NRelativeUnit.ParentPercentage), new NLength(85, NRelativeUnit.ParentPercentage)); m_RadialGauge.BackgroundFillStyle = new NGradientFillStyle(Color.DarkGray, Color.Black); // configure scale NGaugeAxis axis = (NGaugeAxis)m_RadialGauge.Axes[0]; NStandardScaleConfigurator scale = (NStandardScaleConfigurator)axis.ScaleConfigurator; scale.SetPredefinedScaleStyle(PredefinedScaleStyle.Presentation); scale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Arial", 10, FontStyle.Bold); scale.LabelStyle.TextStyle.FillStyle = new NColorFillStyle(Color.White); scale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 0); scale.MinorTickCount = 4; scale.RulerStyle.BorderStyle.Width = new NLength(0); scale.RulerStyle.FillStyle = new NColorFillStyle(Color.DarkGray); // add radial gauge indicators NRangeIndicator rangeIndicator = new NRangeIndicator(); rangeIndicator.Value = 20; rangeIndicator.FillStyle = new NGradientFillStyle(Color.Yellow, Color.Red); rangeIndicator.StrokeStyle.Color = Color.DarkBlue; rangeIndicator.EndWidth = new NLength(20); NInteractivityStyle interactivityStyle1 = new NInteractivityStyle(); interactivityStyle1.Tooltip.Text = "Drag Me"; // interactivityStyle1.ClientMouseEventAttribute.Tag = "Indicator[" + m_Indicator1.UniqueId.ToString() + "]"; rangeIndicator.InteractivityStyle = interactivityStyle1; m_RadialGauge.Indicators.Add(rangeIndicator); NNeedleValueIndicator needleIndicator = new NNeedleValueIndicator(); needleIndicator.Shape.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.White, Color.Red); needleIndicator.Shape.StrokeStyle.Color = Color.Red; m_RadialGauge.Indicators.Add(needleIndicator); m_RadialGauge.SweepAngle = 270; // add radial gauge control.Panels.Add(m_RadialGauge); // create and config ure a numeric display attached to the radial gauge NNumericDisplayPanel numericDisplay = new NNumericDisplayPanel(); numericDisplay.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(70, NRelativeUnit.ParentPercentage)); numericDisplay.ContentAlignment = ContentAlignment.TopCenter; numericDisplay.DisplayStyle = DisplayStyle.SevenSegmentRounded; numericDisplay.SegmentWidth = new NLength(2, NGraphicsUnit.Point); numericDisplay.SegmentGap = new NLength(1, NGraphicsUnit.Point); numericDisplay.CellSize = new NSizeL(new NLength(9, NGraphicsUnit.Point), new NLength(19, NGraphicsUnit.Point)); numericDisplay.ShowDecimalSeparator = true; numericDisplay.ShowLeadingZeros = true; numericDisplay.EnableDecimalFormatting = false; numericDisplay.CellCountMode = DisplayCellCountMode.Auto; numericDisplay.CellCount = 6; numericDisplay.ValueFormatter = new NNumericValueFormatter("00.00"); numericDisplay.CellAlignment = VertAlign.Top; numericDisplay.BackgroundFillStyle = new NColorFillStyle(Color.DimGray); numericDisplay.LitFillStyle = new NGradientFillStyle(Color.Lime, Color.Green); numericDisplay.CellCountMode = DisplayCellCountMode.Fixed; numericDisplay.CellCount = 6; numericDisplay.Padding = new NMarginsL(3, 2, 3, 2); m_RadialGauge.ChildPanels.Add(numericDisplay); // create a sunken border around the display NEdgeBorderStyle borderStyle = new NEdgeBorderStyle(BorderShape.RoundedRect); borderStyle.OuterBevelWidth = new NLength(0); borderStyle.MiddleBevelWidth = new NLength(0); numericDisplay.BorderStyle = borderStyle; NIndicatorDragTool indicatorDragTool = new NIndicatorDragTool(); indicatorDragTool.IndicatorDragCallback = new IndicatorDragCallback(); control.Controller.Tools.Add(indicatorDragTool); control.Controller.Tools.Add(new NTooltipTool()); NRangeIndicator range = (NRangeIndicator)control.Gauges[0].Indicators[0]; range.AllowDragging = true; if (range.AllowDragging) { range.InteractivityStyle.Tooltip.Text = "Drag Me"; } else { range.InteractivityStyle.Tooltip.Text = range.Range.End.ToString(); } NNeedleValueIndicator needle = (NNeedleValueIndicator)control.Gauges[0].Indicators[1]; needle.AllowDragging = true; if (needle.AllowDragging) { needle.InteractivityStyle.Tooltip.Text = "Drag Me"; } else { needle.InteractivityStyle.Tooltip.Text = needle.Value.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { if (!NThinChartControl1.Initialized) { // enable jittering (full scene antialiasing) NThinChartControl1.BackgroundStyle.FrameStyle.Visible = false; NThinChartControl1.Settings.JitterMode = JitterMode.Enabled; // set a chart title NLabel title = NThinChartControl1.Labels.AddHeader("Image Map Tools<br/>Tooltip, Browser Redirect, Cursor Change"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; title.TextStyle.TextFormat = TextFormat.XML; // setup the chart NChart chart = NThinChartControl1.Charts[0]; chart.Enable3D = true; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); chart.Projection.SetPredefinedProjection(PredefinedProjection.Perspective1); chart.Axis(StandardAxis.Depth).Visible = false; // add a bar series NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.DataLabelStyle.Visible = false; bar.Legend.Mode = SeriesLegendMode.DataPoints; bar.Legend.Format = "<label> <percent>"; bar.AddDataPoint(new NDataPoint(42, "Chart")); bar.AddDataPoint(new NDataPoint(56, "Diagram")); bar.AddDataPoint(new NDataPoint(12, "Gauges")); bar.AddDataPoint(new NDataPoint(23, "Maps")); // modify the axis labels NOrdinalScaleConfigurator ordinalScale = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; ordinalScale.AutoLabels = false; for (int i = 0; i < bar.Labels.Count; i++) { ordinalScale.Labels.Add((string)bar.Labels[i]); } // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.PaleMultiColor); styleSheet.Apply(chart); // apply layout ApplyLayoutTemplate(0, NThinChartControl1, chart, title, NThinChartControl1.Legends[0]); // add interactivity styles with the urls to redirect to and the corresponding cursors and tooltips NInteractivityStyle interactivityStyle = new NInteractivityStyle("Click here to jump to Chart Gallery", CursorType.Hand); interactivityStyle.UrlLink.OpenInNewWindow = true; interactivityStyle.UrlLink.Url = "https://www.nevron.com/products-dot-net-chart-gallery-charting-types-bar-chart.aspx"; bar.InteractivityStyles[0] = interactivityStyle; interactivityStyle = new NInteractivityStyle("Click here to jump to Diagram Gallery", CursorType.Hand); interactivityStyle.UrlLink.OpenInNewWindow = true; interactivityStyle.UrlLink.Url = "https://www.nevron.com/products-dot-net-diagram-gallery-flow-and-organization-charts-flow-charts.aspx"; bar.InteractivityStyles[1] = interactivityStyle; interactivityStyle = new NInteractivityStyle("Click here to jump to Gauge Gallery", CursorType.Hand); interactivityStyle.UrlLink.OpenInNewWindow = true; interactivityStyle.UrlLink.Url = "https://www.nevron.com/products-dot-net-chart-gallery-gauges-radial-gauge.aspx"; bar.InteractivityStyles[2] = interactivityStyle; interactivityStyle = new NInteractivityStyle("Click here to jump to Maps Gallery", CursorType.Hand); interactivityStyle.UrlLink.OpenInNewWindow = true; interactivityStyle.UrlLink.Url = "https://www.nevron.com/products-dot-net-diagram-gallery-maps-general-maps.aspx"; bar.InteractivityStyles[3] = interactivityStyle; NThinChartControl1.Controller.SetActivePanel(chart); } NThinChartControl1.Controller.Tools.Clear(); if (EnableBrowserRedirectCheckBox.Checked) { NThinChartControl1.Controller.Tools.Add(new NBrowserRedirectTool()); } if (EnableTooltipsCheckBox.Checked) { NTooltipTool tooltipTool = new NTooltipTool(); tooltipTool.FollowMouse = true; NThinChartControl1.Controller.Tools.Add(tooltipTool); } if (EnableCursorChangeCheckBox.Checked) { NThinChartControl1.Controller.Tools.Add(new NCursorTool()); } NThinChartControl1.Controller.Tools.Add(new NTrackballTool()); }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.Panels.Clear(); // add watermarks string[] divIds = new string[] { "toyota", "chevrolet", "ford", "volkswagen", "hyundai", "nissan", "mazda" }; nChartControl1.BackgroundStyle.FillStyle = new NColorFillStyle(Color.LightGray); nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // add header NLabel header = nChartControl1.Labels.AddHeader("Car Sales by Company"); header.TextStyle.BackplaneStyle.Visible = false; header.TextStyle.TextFormat = TextFormat.XML; header.TextStyle.ShadowStyle.Type = ShadowType.GaussianBlur; header.TextStyle.FillStyle = new NColorFillStyle(Color.Black); header.DockMode = PanelDockMode.Top; header.Margins = new NMarginsL(0, 10, 0, 0); // by default the chart contains a cartesian chart which cannot display a pie series NDockPanel dockPanel = new NDockPanel(); dockPanel.DockMode = PanelDockMode.Fill; dockPanel.PositionChildPanelsInContentBounds = true; dockPanel.Margins = new NMarginsL(10, 10, 10, 10); nChartControl1.Panels.Add(dockPanel); AddWatermark(dockPanel, "ToyotaLogo.png"); AddWatermark(dockPanel, "ChevroletLogo.png"); AddWatermark(dockPanel, "FordLogo.png"); AddWatermark(dockPanel, "VolkswagenLogo.png"); AddWatermark(dockPanel, "HyundaiLogo.png"); AddWatermark(dockPanel, "NissanLogo.png"); AddWatermark(dockPanel, "MazdaLogo.png"); NPieChart pieChart = new NPieChart(); dockPanel.ChildPanels.Add(pieChart); NPieSeries pieSeries = new NPieSeries(); pieChart.Series.Add(pieSeries); // add some data pieSeries.AddDataPoint(new NDataPoint(11.6, "Toyota Corolla")); pieSeries.AddDataPoint(new NDataPoint(9.7, "Chevrolet Cruze")); pieSeries.AddDataPoint(new NDataPoint(9.3, "Ford Focus")); pieSeries.AddDataPoint(new NDataPoint(7.1, "Volkswagen Jetta")); pieSeries.AddDataPoint(new NDataPoint(7.0, "Hyundai Elantra")); pieSeries.AddDataPoint(new NDataPoint(6.1, "Nissan Versa")); pieSeries.AddDataPoint(new NDataPoint(5.9, "Mazda 3")); pieSeries.AddDataPoint(new NDataPoint(43.4, "Other")); pieSeries.PieStyle = PieStyle.Torus; pieSeries.LabelMode = PieLabelMode.Center; // configure interactivity for data points for (int i = 0; i < pieSeries.Values.Count; i++) { NInteractivityStyle interactivityStyle = new NInteractivityStyle(); if (i < nChartControl1.Watermarks.Count) { string watermarkId = new NElementIdentifier(nChartControl1.Watermarks[i].Id).ToString(); interactivityStyle.CustomMapAreaAttribute.JScriptAttribute = "onmouseover = 'ShowWatermark(evt, \"" + watermarkId + "\", \"" + divIds[i] + "\")'"; } else { interactivityStyle.CustomMapAreaAttribute.JScriptAttribute = "onmouseover = 'ShowWatermark(evt, null, null)'"; } pieSeries.InteractivityStyles.Add(i, interactivityStyle); } nChartControl1.InteractivityStyle.CustomMapAreaAttribute.JScriptAttribute = "onmouseover = 'ShowWatermark(evt, null, null)'"; // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.BrightMultiColor); styleSheet.Apply(nChartControl1.Document); // configure the control to generate SVG. NImageResponse imageResponse = new NImageResponse(); NSvgImageFormat svgImageFormat = new NSvgImageFormat(); svgImageFormat.EnableInteractivity = true; svgImageFormat.CustomScript = GetScript(); svgImageFormat.EmbedImagesInSvg = true; svgImageFormat.EmbeddedImageFormat = new NJpegImageFormat(); Hashtable attributes = new Hashtable(); attributes["preserveAspectRatio"] = "yMid slice"; // attributes["onload"] = "Initialize(evt)"; svgImageFormat.Attributes = attributes; imageResponse.ImageFormat = svgImageFormat; nChartControl1.ServerSettings.BrowserResponseSettings.DefaultResponse = imageResponse; }
protected void Page_Load(object sender, System.EventArgs e) { // start document initialization Document = NDrawingView1.Document; Document.BeginInit(); Document.Width = NDrawingView1.Dimensions.Width; Document.Height = NDrawingView1.Dimensions.Height; XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(this.MapPathSecure(this.TemplateSourceDirectory + "\\MapOfUSA.xml")); XmlElement map = (XmlElement)xmlDocument.ChildNodes[0]; Color[] stateColorTable = new Color[6]; stateColorTable[0] = Color.LightPink; stateColorTable[1] = Color.Bisque; stateColorTable[2] = Color.Moccasin; stateColorTable[3] = Color.MistyRose; stateColorTable[4] = Color.PowderBlue; stateColorTable[5] = Color.Ivory; int stateCounter = 0; Color stateHighlighColor = Color.Orange; foreach (XmlElement state in map.ChildNodes) { string stateId = state.Attributes["Id"].Value.ToString(); NCompositeShape stateShape = CreateState(state); // add to active layer Document.ActiveLayer.AddChild(stateShape); // NRotatedBoundsLabel label = new NRotatedBoundsLabel("Click to go to :" + stateId + " webpage", stateShape.UniqueId, new Nevron.Diagram.NMargins()); // stateShape.Labels.AddChild(label); // set fill and stroke styles Color stateColor = stateColorTable[stateCounter % 6]; stateShape.Style.FillStyle = new NColorFillStyle(stateColor); stateShape.Style.StrokeStyle = new NStrokeStyle(1, Color.Black); NInteractivityStyle interactivityStyle = new NInteractivityStyle(); stateShape.Style.InteractivityStyle = interactivityStyle; string elementId = new NElementIdentifier(((INElement)stateShape.Primitives.GetChildAt(0)).Id).ToString(); string stateScript = "onmouseover = 'HighlightState(\"" + elementId + "\", \"" + ColorToSVG(stateHighlighColor) + "\")' onmouseout = 'HighlightState(\"" + elementId + "\", \"" + ColorToSVG(stateColor) + "\")'"; interactivityStyle.CustomMapAreaAttribute.JScriptAttribute = stateScript; interactivityStyle.UrlLink.Url = "http://worldatlas.com/webimage/countrys/namerica/usstates/" + stateId.ToString() + ".htm"; interactivityStyle.UrlLink.OpenInNewWindow = true; NElementIdentifier identifier = new NElementIdentifier(stateShape.Id); stateCounter++; } Document.BackgroundStyle.FillStyle = new NGradientFillStyle(GradientStyle.Horizontal, GradientVariant.Variant1, Color.LightSeaGreen, Color.LightBlue); // change the response type to SVG NImageResponse response = new NImageResponse(); NSvgImageFormat svgImageFormat = new NSvgImageFormat(); svgImageFormat.EnableInteractivity = true; svgImageFormat.CustomScript = GetScript(); Hashtable attributes = new Hashtable(); attributes["onload"] = "Initialize(evt)"; svgImageFormat.Attributes = attributes; response.ImageFormat = svgImageFormat; NDrawingView1.ServerSettings.BrowserResponseSettings.DefaultResponse = response; }
private NInteractivityStyle CreateInteractivityStyle(string shapeName) { NInteractivityStyle interactivityStyle = new NInteractivityStyle("Click on me to make me Red"); return(interactivityStyle); }
private void InitDocument() { // modify the connectors style sheet NStyleSheet styleSheet = (NDrawingView1.Document.StyleSheets.GetChildByName(NDR.NameConnectorsStyleSheet, -1) as NStyleSheet); NTextStyle textStyle = new NTextStyle(); textStyle.BackplaneStyle.Visible = true; textStyle.BackplaneStyle.StandardFrameStyle.InnerBorderWidth = new NLength(0); textStyle.BackplaneStyle.FillStyle = new NColorFillStyle(Color.FromArgb(200, Color.White)); styleSheet.Style.TextStyle = textStyle; styleSheet.Style.StrokeStyle = new NStrokeStyle(1, Color.Black); styleSheet.Style.StartArrowheadStyle.StrokeStyle = new NStrokeStyle(Color.FromArgb(0, Color.Black)); styleSheet.Style.StartArrowheadStyle.FillStyle = new NColorFillStyle(Color.FromArgb(0, Color.White)); styleSheet.Style.EndArrowheadStyle.StrokeStyle = new NStrokeStyle(1, Color.Black); // modify default stroke style NDrawingView1.Document.Style.StrokeStyle = new NStrokeStyle(Color.FromArgb(0, Color.White)); // configure the document NDrawingView1.Document.Bounds = new NRectangleF(0, 0, 420, 320); NDrawingView1.Document.GraphicsSettings.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; NDrawingView1.Document.GraphicsSettings.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; NDrawingView1.Document.GraphicsSettings.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality; NDrawingView1.Document.MeasurementUnit = NGraphicsUnit.Pixel; NDrawingView1.Document.DrawingScaleMode = DrawingScaleMode.NoScale; NDrawingView1.Document.BackgroundStyle.FrameStyle.Visible = false; // predefined styles NAdvancedGradientFillStyle ag1 = new NAdvancedGradientFillStyle(); ag1.BackgroundColor = Color.Navy; ag1.Points.Add(new NAdvancedGradientPoint(Color.SkyBlue, 50, 50, 0, 79, AGPointShape.Circle)); NAdvancedGradientFillStyle ag2 = new NAdvancedGradientFillStyle(); ag2.BackgroundColor = Color.DarkRed; ag2.Points.Add(new NAdvancedGradientPoint(Color.Red, 50, 50, 0, 71, AGPointShape.Circle)); NAdvancedGradientFillStyle ag3 = new NAdvancedGradientFillStyle(); ag3.BackgroundColor = Color.Orange; ag3.Points.Add(new NAdvancedGradientPoint(Color.Yellow, 50, 50, 0, 50, AGPointShape.Circle)); // shapes NBasicShapesFactory factory = new NBasicShapesFactory(NDrawingView1.Document); NEllipseShape centerEllipse = factory.CreateShape((int)BasicShapes.Ellipse) as NEllipseShape; centerEllipse.Name = "CenterEllipse"; centerEllipse.Width = 50f; centerEllipse.Height = 50f; centerEllipse.Center = new NPointF(210, 160); centerEllipse.Style.StrokeStyle = null; centerEllipse.Style.FillStyle = ag3; centerEllipse.Style.InteractivityStyle = new NInteractivityStyle(true, centerEllipse.Name); NEllipseShape rotatingEllipse = factory.CreateShape((int)BasicShapes.Ellipse) as NEllipseShape; rotatingEllipse.Name = "RotatingEllipse"; rotatingEllipse.Width = 35f; rotatingEllipse.Height = 35f; rotatingEllipse.Center = new NPointF(centerEllipse.Bounds.X - 100, centerEllipse.Center.Y); rotatingEllipse.Style.StrokeStyle = null; rotatingEllipse.Style.FillStyle = ag1; rotatingEllipse.PinPoint = new NPointF(centerEllipse.Center.X, centerEllipse.Center.Y); rotatingEllipse.Style.InteractivityStyle = new NInteractivityStyle(true, rotatingEllipse.Name); NEllipseShape rotatingEllipse2 = factory.CreateShape((int)BasicShapes.Ellipse) as NEllipseShape; rotatingEllipse2.Name = "RotatingEllipse2"; rotatingEllipse2.Width = 15f; rotatingEllipse2.Height = 15f; rotatingEllipse2.Center = new NPointF(centerEllipse.Bounds.Right + 30, centerEllipse.Center.Y); rotatingEllipse2.Style.StrokeStyle = null; rotatingEllipse2.Style.FillStyle = ag2; rotatingEllipse2.PinPoint = new NPointF(centerEllipse.Center.X, centerEllipse.Center.Y); rotatingEllipse2.Style.InteractivityStyle = new NInteractivityStyle(true, rotatingEllipse2.Name); NEllipseShape orbit1 = factory.CreateShape((int)BasicShapes.Ellipse) as NEllipseShape; orbit1.Name = "orbit1"; orbit1.Width = 2 * (centerEllipse.Center.X - rotatingEllipse.Center.X); orbit1.Height = orbit1.Width; orbit1.Center = new NPointF(centerEllipse.Center.X, centerEllipse.Center.Y); orbit1.Style.StrokeStyle = new NStrokeStyle(Color.Black); orbit1.Style.StrokeStyle.Pattern = LinePattern.Dot; orbit1.Style.StrokeStyle.Factor = 2; orbit1.Style.FillStyle = new NColorFillStyle(Color.FromArgb(0, Color.White)); NEllipseShape orbit2 = factory.CreateShape((int)BasicShapes.Ellipse) as NEllipseShape; orbit2.Name = "orbit2"; orbit2.Width = 2 * (centerEllipse.Center.X - rotatingEllipse2.Center.X); orbit2.Height = orbit2.Width; orbit2.Center = new NPointF(centerEllipse.Center.X, centerEllipse.Center.Y); orbit2.Style.StrokeStyle = new NStrokeStyle(Color.Black); orbit2.Style.StrokeStyle.Pattern = LinePattern.Dot; orbit2.Style.StrokeStyle.Factor = 2; orbit2.Style.FillStyle = new NColorFillStyle(Color.FromArgb(0, Color.White)); NDrawingView1.Document.ActiveLayer.AddChild(orbit1); NDrawingView1.Document.ActiveLayer.AddChild(orbit2); NDrawingView1.Document.ActiveLayer.AddChild(centerEllipse); NDrawingView1.Document.ActiveLayer.AddChild(rotatingEllipse); NDrawingView1.Document.ActiveLayer.AddChild(rotatingEllipse2); // some shapes need to have extra ports NRotatedBoundsPort port = new NRotatedBoundsPort(centerEllipse.UniqueId, ContentAlignment.MiddleCenter); port.Name = "MiddleCenter"; centerEllipse.Ports.AddChild(port); port = new NRotatedBoundsPort(rotatingEllipse.UniqueId, ContentAlignment.MiddleCenter); port.Name = "MiddleCenter"; rotatingEllipse.Ports.AddChild(port); // connect shapes in levels NShape connector = base.CreateConnector(NDrawingView1.Document, centerEllipse, "MiddleCenter", rotatingEllipse, "MiddleCenter", ConnectorType.Line, "Radius"); NInteractivityStyle istyle = connector.ComposeInteractivityStyle(); }
protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("HTML Image Map with Postback (Server Events) 2"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL( new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // configure the legend NLegend legend = nChartControl1.Legends[0]; legend.SetPredefinedLegendStyle(PredefinedLegendStyle.Bottom); legend.InteractivityStyle.GeneratePostback = true; legend.Header.Text = "Company Score"; // configure the chart NChart chart = nChartControl1.Charts[0]; chart.Height = 40; chart.Enable3D = true; chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.GlitterLeft); chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalHalf); chart.BoundsMode = BoundsMode.Fit; chart.Location = new NPointL( new NLength(8, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL( new NLength(84, NRelativeUnit.ParentPercentage), new NLength(60, NRelativeUnit.ParentPercentage)); chart.Axis(StandardAxis.Depth).Visible = false; chart.Axis(StandardAxis.Depth).InteractivityStyle.GeneratePostback = true; chart.Axis(StandardAxis.PrimaryX).InteractivityStyle.GeneratePostback = true; chart.Axis(StandardAxis.PrimaryY).InteractivityStyle.GeneratePostback = true; chart.Wall(ChartWallType.Back).InteractivityStyle.GeneratePostback = true; chart.Wall(ChartWallType.Left).InteractivityStyle.GeneratePostback = true; chart.Wall(ChartWallType.Floor).InteractivityStyle.GeneratePostback = true; // add an axis stripe NAxisStripe stripe = chart.Axis(StandardAxis.PrimaryY).Stripes.Add(20, 33); stripe.FillStyle = new NColorFillStyle(Color.PaleGoldenrod); stripe.ShowAtWalls = new ChartWallType[] { ChartWallType.Left, ChartWallType.Back }; stripe.InteractivityStyle.GeneratePostback = true; // setup X axis NOrdinalScaleConfigurator ordinalScale = new NOrdinalScaleConfigurator(); ordinalScale.AutoLabels = false; ordinalScale.Labels.Add("Ford"); ordinalScale.Labels.Add("VW"); ordinalScale.Labels.Add("Toyota"); ordinalScale.Labels.Add("BMW"); ordinalScale.Labels.Add("Peugeot"); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = ordinalScale; // add a bar chart NBarSeries bar = (NBarSeries)chart.Series.Add(SeriesType.Bar); bar.Name = "Fictive Car sales"; bar.BarShape = BarShape.SmoothEdgeBar; bar.Legend.Mode = SeriesLegendMode.DataPoints; bar.DataLabelStyle.Visible = true; bar.DataLabelStyle.Format = "<value>"; bar.InteractivityStyle.Tooltip = new NTooltipAttribute("<value> <label>"); bar.AddDataPoint(new NDataPoint(22, "Ford", new NColorFillStyle(Color.DarkKhaki))); bar.AddDataPoint(new NDataPoint(32, "VW", new NColorFillStyle(Color.OliveDrab))); bar.AddDataPoint(new NDataPoint(45, "Toyota", new NColorFillStyle(Color.DarkSeaGreen))); bar.AddDataPoint(new NDataPoint(27, "BMW", new NColorFillStyle(Color.CadetBlue))); bar.AddDataPoint(new NDataPoint(40, "Peugeot", new NColorFillStyle(Color.LightSlateGray))); for (int i = 0; i < bar.Values.Count; i++) { NInteractivityStyle interactivityStyle = new NInteractivityStyle(); interactivityStyle.GeneratePostback = true; bar.InteractivityStyles[i] = interactivityStyle; } // configure the control to generate image map with postback NHtmlImageMapResponse imageMapResponse = new NHtmlImageMapResponse(); imageMapResponse.GridCellSize = 2; nChartControl1.ServerSettings.BrowserResponseSettings.DefaultResponse = imageMapResponse; this.nChartControl1.Click += new EventHandler(this.NChartControl1_Click); }