Dhtmlxwindow attachURL issue - dhtmlx

I have created a dhtmlxwindow object and loaded a jsp page using attachURL.
dhxwindow.attachURL('myPage.jsp');
and in myPage.jsp ,
i have created a layout object.
var mylayout = new dhtmlxLayoutObject(document.body, '3u');
toolbar = mylayout.cells('a').attachToolbar();
toolbar.addButton("Validate", 0, "", "images/queryValidation24.png", "images/queryValidation24.png");
toolbar.addButton("Preview", 1, "", "images/previewBtn24.png", "images/previewBtn24.png");
toolbar.setAlign('right');
//and i have other dhtmlxcomponents in other cells
Problem is i am unable to view the toolbar.
What will be the problem?

First of all you need to use correct syntax as CAPITAL letters:
var mylayout = new dhtmlXLayoutObject(document.body, '3U');
Main page:
dhxWins = new dhtmlXWindows();
dhxWins.enableAutoViewport(false);
dhxWins.attachViewportTo(document.body);
dhxWins.setImagePath("../dhtmlxWindows/codebase/imgs/");
w1 = dhxWins.createWindow("w1", 100, 100, 500, 500);
w1.attachURL("layout_toolbar_test.html");
Attached page:
var mylayout = new dhtmlXLayoutObject(document.body, '3U');
toolbar = mylayout.cells('a').attachToolbar();
toolbar.addButton("Validate", 0, "", "images/queryValidation24.png", "images/queryValidation24.png");
toolbar.addButton("Preview", 1, "", "images/previewBtn24.png", "images/previewBtn24.png");
toolbar.setAlign('right');
Result (sorry, haven't your image files):

Related

How to display UIDatePicker to choose date

I am following this documentation so that I can pick a date in my Xamarin.iOS app like in this image:
https://learn.microsoft.com/en-us/xamarin/ios/user-interface/controls/picker-images/image9.png
But I can't get it to work. My code:
var datePickerView = new UIDatePicker();
datePickerView.MinimumDate = (NSDate)DateTime.Today.AddDays(-7);
datePickerView.MaximumDate = NSDate.Now;
datePickerView.Mode = UIDatePickerMode.Date;
datePickerView.Locale = NSLocale.FromLocaleIdentifier("en_US");
datePickerView.MoveAndResizeFrame(
UIScreen.MainScreen.Bounds.X - UIScreen.MainScreen.Bounds.Width,
UIScreen.MainScreen.Bounds.Height - 230,
UIScreen.MainScreen.Bounds.Width,
180
);
// Add(datePickerView); do I add it to my view?
I also tried making it my InputView of a UITextField but I get an ugly dialog that's not even usable like this.
var t = new UITextField();
t.InputView = datePickerView;
t.ResizeFrame(300, 50);
t.Placeholder = "enter date";
t.TextColor = UIColor.Black;
Add(t);
I am running this app on iPad with iOS 14.5
The problem is related with the position(frame) you set on the datepicker,the view would locate beyond of the screen in that scenario .
Use the following code , it works fine on my side .
Click on the label , then display the datepicker menu.
var datePickerView = new UIDatePicker();
datePickerView.MinimumDate = (NSDate)DateTime.Today.AddDays(-7);
datePickerView.MaximumDate = NSDate.Now;
datePickerView.Mode = UIDatePickerMode.Date;
datePickerView.Locale = NSLocale.FromLocaleIdentifier("en_US");
datePickerView.Frame = new CGRect(0, 0, UIScreen.MainScreen.Bounds.Width, 180); //this line
Add(datePickerView);

How to create dynamic charts in a power point by using Aspose slides

Need help for creating dynamic charts in a power point by using Aspose slides.
#Mohini,
I have observed your requirements and like to share that Aspose.Slides offers you to create MSO charts programmatically. I suggest you to please try using following sample code to create a Clustered Column chart.
// Instantiate Presentation class that represents PPTX file
Presentation pres = new Presentation();
// Access first slide
ISlide sld = pres.Slides[0];
// Add chart with default data
IChart chart = sld.Shapes.AddChart(ChartType.ClusteredColumn, 0, 0, 500, 500);
// Setting chart Title
// Chart.ChartTitle.TextFrameForOverriding.Text = "Sample Title";
chart.ChartTitle.AddTextFrameForOverriding("Sample Title");
chart.ChartTitle.TextFrameForOverriding.TextFrameFormat.CenterText = NullableBool.True;
chart.ChartTitle.Height = 20;
chart.HasTitle = true;
// Set first series to Show Values
chart.ChartData.Series[0].Labels.DefaultDataLabelFormat.ShowValue = true;
// Setting the index of chart data sheet
int defaultWorksheetIndex = 0;
// Getting the chart data worksheet
IChartDataWorkbook fact = chart.ChartData.ChartDataWorkbook;
// Delete default generated series and categories
chart.ChartData.Series.Clear();
chart.ChartData.Categories.Clear();
int s = chart.ChartData.Series.Count;
s = chart.ChartData.Categories.Count;
// Adding new series
chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 0, 1, "Series 1"), chart.Type);
chart.ChartData.Series.Add(fact.GetCell(defaultWorksheetIndex, 0, 2, "Series 2"), chart.Type);
// Adding new categories
chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, 1, 0, "Caetegoty 1"));
chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, 2, 0, "Caetegoty 2"));
chart.ChartData.Categories.Add(fact.GetCell(defaultWorksheetIndex, 3, 0, "Caetegoty 3"));
// Take first chart series
IChartSeries series = chart.ChartData.Series[0];
// Now populating series data
series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 1, 1, 20));
series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 2, 1, 50));
series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 3, 1, 30));
// Setting fill color for series
series.Format.Fill.FillType = FillType.Solid;
series.Format.Fill.SolidFillColor.Color = Color.Red;
// Take second chart series
series = chart.ChartData.Series[1];
// Now populating series data
series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 1, 2, 30));
series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 2, 2, 10));
series.DataPoints.AddDataPointForBarSeries(fact.GetCell(defaultWorksheetIndex, 3, 2, 60));
// Setting fill color for series
series.Format.Fill.FillType = FillType.Solid;
series.Format.Fill.SolidFillColor.Color = Color.Green;
// First label will be show Category name
IDataLabel lbl = series.DataPoints[0].Label;
lbl.DataLabelFormat.ShowCategoryName = true;
lbl = series.DataPoints[1].Label;
lbl.DataLabelFormat.ShowSeriesName = true;
// Show value for third label
lbl = series.DataPoints[2].Label;
lbl.DataLabelFormat.ShowValue = true;
lbl.DataLabelFormat.ShowSeriesName = true;
lbl.DataLabelFormat.Separator = "/";
// Save presentation with chart
pres.Save(dataDir + "AsposeChart_out.pptx", SaveFormat.Pptx);
I am working as Support developer/ Evangelist at Aspose.
Many Thanks,

Splash screen with animation and delay

I want to code a splash screen which, after clicking in a presentation´s image start to do an animation (over the image) and, 5 seconds after, go to a Login page.
I tried to find the solution of it, but the answer use to be related with a specific plataform.
My idea is to code it over cross plataform.
After researching, I found the solution coming from Xamarin offical page (animation´s samples) and another page (for the delay) I don´t remember the site...
I´m posting this question and answer because I think could be really interesting for the community.
Button startButton = new Button() { Image = "splashlogo.png", BackgroundColor = Xamarin.Forms.Color.Transparent, HorizontalOptions = Xamarin.Forms.LayoutOptions.Center, Scale = 3.5};
startButton.Clicked += async (object sender, EventArgs e) =>
{
var parentAnimation = new Animation();
var scaleUpAnimation = new Animation(v => startButton.Scale = v, 1, 2, Easing.SpringIn);
var rotateAnimation = new Animation(v => startButton.Rotation = v, 0, 360);
var scaleDownAnimation = new Animation(v => startButton.Scale = v, 2, 1, Easing.SpringOut);
parentAnimation.Add(0, 0.5, scaleUpAnimation);
parentAnimation.Add(0, 1, rotateAnimation);
parentAnimation.Add(0.5, 1, scaleDownAnimation);
parentAnimation.Commit(startButton, "ChildAnimations", 16, 4000, null);
await Task.Delay(5000);
await App.Current.MainPage.Navigation.PushModalAsync(new Login());
};
public static async Task Sleep(int ms)
{
await Task.Delay(ms);
}

Loading and displaying an image on the canvas using scala.js

I just started messing with scala.js and got stuck pretty early. I have no scala experience so I probably overlooked something simple. I try to display an image on the canvas. I tried:
var image:HTMLImageElement = new HTMLImageElement()
image.src = "pathToSource"
image.onload = { () =>
ctx.drawImage(image, 0, 0, 200, 200) //ctx is the canvas rendering context
}
The problem with this code is that onload doesn't seem to exist, even though I can find it here: https://github.com/scala-js/scala-js-dom/blob/master/src/main/scala/org/scalajs/dom/raw/Html.scala#L1333
I also tried a few other methods like onloaddata but I cant figure out what the compiler wants from me:
var image:dom.raw.HTMLImageElement = new HTMLImageElement()
image.src = "/img/image.png"
image.onloadeddata = new js.Function1[Event, _]{
def apply(v1: Event):Unit={
ctx.drawImage(image,0,0,200,200)
}
}
Anyone knows how to load and display an image with scala js?
Thanks in advance!
You have to create the image with dom.document.createElement("img")
and then use onload event on the created image, here is a working example:
val ctx = canvas.getContext("2d")
.asInstanceOf[dom.CanvasRenderingContext2D]
var image = dom.document.createElement("img").asInstanceOf[HTMLImageElement]
image.src = "/img/image.gif"
image.onload = (e: dom.Event) => {
ctx.drawImage(image, 0, 0, 525, 600, 0, 0, 525, 600)
}
Which version of org.scalajs.dom are you using? It looks like onload was added quite recently, in version 0.8.2. That might be the source of your confusion. (I'm on version 0.8.0, and get the same error.)
For reference, the idiomatic Scala syntax for something like this would usually be something like:
image.onloadeddata = { evt:Event =>
ctx.drawImage(image, 0, 0, 200, 200) //ctx is the canvas rendering context
}
or possibly (in some cases, if there is ambiguity):
image.onloadeddata = { evt:Event =>
ctx.drawImage(image, 0, 0, 200, 200) //ctx is the canvas rendering context
}:js.Function1[Event, _]
You're missing an = operator right after .onload.

ASP.NET MVC Chart Helper. How to set different color for each Bar/Column on chart?

I am using the ASP.NET MVC 3.0 Chart Helper.
Fore some reason colors scheme (e.g Rainfall) applied only for Pie and Doughnut charts and not for any another types (Bar, Column etc).
The bars/columns on all another charts has all the same color. How to fix that?
Here is my chart:
chart = new System.Web.Helpers.Chart(width: 100, height: 200)
.AddSeries(
chartType: Bar,
legend: Rainfall
xValue: new[] { "Jan", "Feb", "Mar", "Apr", "May" },
yValues: new[] { "20", "20", "40", "10", "10" });
}
Also i was trying to use all schemes from System.Web.Helpers public static class ChartTheme, none of these helped
I found something that works ... its not great but it works
using the old Charting
using System.Web.UI.DataVisualization.Charting;
public ActionResult GetRainfallChart()
{
Chart chart = new Chart();
chart.BackColor = Color.Transparent;
chart.Width = Unit.Pixel(1400);
chart.Height = Unit.Pixel(750);
Series series1 = new Series("Series1");
series1.ChartArea = "ca1";
series1.ChartType = SeriesChartType.Bar;
series1.Font = new System.Drawing.Font("Verdana", 11f, FontStyle.Regular);
series1.Points.Add(new DataPoint
{
AxisLabel = "A",
YValues = new double[] { 100 },
Color = Color.Green,
});
series1.Points.Add(new DataPoint
{
AxisLabel = "B",
YValues = new double[] { 324 },
Color = Color.Red,
});
series1.Points.Add(new DataPoint
{
AxisLabel = "C",
YValues = new double[] { 235 },
Color = Color.Yellow,
});
chart.Series.Add(series1);
ChartArea ca1 = new ChartArea("ca1");
ca1.BackColor = Color.Transparent;
chart.ChartAreas.Add(ca1);
var ms = new MemoryStream();
chart.SaveImage(ms, ChartImageFormat.Png);
ms.Seek(0, SeekOrigin.Begin);
return new FileStreamResult(ms, "image/png");
}
Yes he is correct. One more information
Chart Helper in System.Web.Helpers internally use 'using DV = System.Web.UI.DataVisualization.Charting;' ASP.Net chart control only but wrapped with limited access.
Its better you can use ASP.Net chart if you need more functions
Maybe you found the answer a long time ago but given the fact that I found very little on this topic when searching for a way to colorize the bars of a chart I thought it might be useful to post the solution here when it opened up to me.
It seems that the implementation of System.Web.Helpers.Chart is closely related to System.Web.UI.DataVisualization.Charting.Chart. Given this, I managed to find some clues as to how I could configure the "theme" XML properties:
public const String CHARTS_THEME = #"<Chart BackColor=""#EFEFEF"" BackGradientStyle=""TopBottom"" BorderColor=""#A0A0A0"" BorderWidth=""1"" Palette=""None"" PaletteCustomColors=""#ffcc00"" >
<ChartAreas>
<ChartArea Name=""Default"" _Template_=""All"" BackColor=""Transparent"" BackSecondaryColor=""White"" BorderWidth=""1"" BorderColor=""#A0A0A0"" BorderDashStyle=""Solid"" >
<AxisY>
<MajorGrid Interval=""Auto"" LineColor=""64, 64, 64, 64"" />
<LabelStyle Font=""Verdana, 10pt"" />
</AxisY>
<AxisX LineColor=""#000000"">
<MajorGrid Interval=""Auto"" LineColor=""64, 64, 64, 64"" />
<LabelStyle Font=""Verdana, 10pt"" />
</AxisX>
</ChartArea>
</ChartAreas>
<Legends>
<Legend _Template_=""All"" BackColor=""Transparent"" Docking=""Bottom"" Font=""Verdana, 10pt, style=Plain"" LegendStyle=""Row"">
</Legend>
</Legends>
</Chart>";
Key to this point is to define your own PaletteCustomColors (I have only one color). To make this work, the Palette property must be set to None.
Finally, just use your theme when creating an instance of your chart:
Chart chart = new Chart(width: 600, height: 200, theme:CHARTS_THEME);
Also check out the msdn documentation of System.Web.UI.DataVisualization.Charting.Chart to discover other ways to style your chart:
http://msdn.microsoft.com/en-us/library/dd467201.aspx

Resources